POV-Ray : Newsgroups : povray.programming : How to Build a GUI Extension to POV-Ray for Windows. Server Time
28 Jul 2024 12:36:12 EDT (-0400)
  How to Build a GUI Extension to POV-Ray for Windows. (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Andrew Wilcox
Subject: test post - ignore
Date: 3 Aug 2002 20:13:41
Message: <3d4c71b5$1@news.povray.org>
test post


Post a reply to this message

From: Andrew Wilcox
Subject: Trouble persisting Enabled state. Need Help.
Date: 5 Aug 2002 09:49:25
Message: <3d4e8265$1@news.povray.org>
I cannot do an (*Instance->Request)(RequestGetVars, &ExternalVars) ; in the
following method. I assume its because POV hasn't fully initialized Instance
yet. I need to know the Instance.HomePath so that I can read my .ini file
and initialize Instance.Enabled correctly.

What do I do?

Is there some place else I can set Enabled after POV has initialized the
DLL?  Or do I just have to know the directory where POV is installed,
without being able to ask POV itself?

Thanks in advance,

Andrew Wilcox


--
#macro Q(A,E,W)box{-A/2,A/2pigment{rgb 9*W}translate E*A+W/1000}#end#macro
M(D,E)#local A=1/pow(3,D);#if(D<3)#local C=D+1;union{M(C,1)M(C,x+y)M(C,x+z)
M(C,y+z)M(C,x+y-z)M(C,x+z-y)M(C,y+z-x)M(C,x-y)M(C,z-x)M(C,y-z)M(C,y-x)M(C,
x-z)M(C,z-y)M(C,x-y-z)M(C,y-x-z)M(C,z-x-y)translate A*E}#else Q(A,E,x)Q(A,E
,y)Q(A,E,z)#end#end union{M(0,0)rotate<45,145,0>translate z*2}//Andrew
"Tom Galvin" <tom### [at] dataforgenospamcom> wrote in message
news:3d4884d9$1@news.povray.org...


Post a reply to this message

From: Chris Cason
Subject: Re: Trouble persisting Enabled state. Need Help.
Date: 5 Aug 2002 14:20:55
Message: <3d4ec207@news.povray.org>
"Andrew Wilcox" <awi### [at] unpuzzledcom> wrote in message
news:3d4e8265$1@news.povray.org...
> I cannot do an (*Instance->Request)(RequestGetVars, &ExternalVars) ; in the
> following method. I assume its because POV hasn't fully initialized Instance
> yet. I need to know the Instance.HomePath so that I can read my .ini file
> and initialize Instance.Enabled correctly.
>
> What do I do?
>
> Is there some place else I can set Enabled after POV has initialized the
> DLL?  Or do I just have to know the directory where POV is installed,
> without being able to ask POV itself?

You could ask windows for the path to your DLL. Or you could store the state in
the registry instead of an INI file (IMO this is the best choice, POV uses an
INI file because it predates Windows 9x ; you don't have to follow our example).

Alternatively you can look at HKCU\Software\POV-Ray\CurrentVersion\Windows\Home.
Note that v3.1 of POVWIN uses HKLM for this key. If both version are installed,
the HKLM one will point at v3.1, and the HKCU will point at v3.5. But there will
also be an entry in HKLM\Software\POV-Ray\v3.5\Windows\Home pointing at the v3.5
install (provided that the person who installed it had admin rights).

-- Chris


Post a reply to this message

From: Andrew Wilcox
Subject: Re: Trouble persisting Enabled state. Need Help.
Date: 5 Aug 2002 15:31:06
Message: <3d4ed27a@news.povray.org>
Could I put in an HKCU\Software\POV-Ray\GUIEXT\<myguiext> key?  Or should I
use a completely different path all together?

The registry would be easier to access anyway, than a file.

--
#macro Q(A,E,W)box{-A/2,A/2pigment{rgb 9*W}translate E*A+W/1000}#end#macro
M(D,E)#local A=1/pow(3,D);#if(D<3)#local C=D+1;union{M(C,1)M(C,x+y)M(C,x+z)
M(C,y+z)M(C,x+y-z)M(C,x+z-y)M(C,y+z-x)M(C,x-y)M(C,z-x)M(C,y-z)M(C,y-x)M(C,
x-z)M(C,z-y)M(C,x-y-z)M(C,y-x-z)M(C,z-x-y)translate A*E}#else Q(A,E,x)Q(A,E
,y)Q(A,E,z)#end#end union{M(0,0)rotate<45,145,0>translate z*2}//Andrew


Post a reply to this message

From: Ron Parker
Subject: Re: Trouble persisting Enabled state. Need Help.
Date: 5 Aug 2002 15:51:53
Message: <slrnaktlqs.1c8.ron.parker@fwi.com>
On Mon, 5 Aug 2002 14:35:56 -0500, Andrew Wilcox wrote:
> Could I put in an HKCU\Software\POV-Ray\GUIEXT\<myguiext> key?  Or should I
> use a completely different path all together?

You should use a completely different path, like
HKCU\Software\<my (company) name>\<myguiext>


-- 
#macro R(L P)sphere{L __}cylinder{L P __}#end#macro P(_1)union{R(z+_ z)R(-z _-z)
R(_-z*3_+z)torus{1__ clipped_by{plane{_ 0}}}translate z+_1}#end#macro S(_)9-(_1-
_)*(_1-_)#end#macro Z(_1 _ __)union{P(_)P(-_)R(y-z-1_)translate.1*_1-y*8pigment{
rgb<S(7)S(5)S(3)>}}#if(_1)Z(_1-__,_,__)#end#end Z(10x*-2,.2)camera{rotate x*90}


Post a reply to this message

From: Tom Galvin
Subject: Re: How to Build a GUI Extension to POV-Ray for Windows.
Date: 5 Aug 2002 23:38:15
Message: <3d4f44a7$1@news.povray.org>
"Andrew Wilcox" <awi### [at] unpuzzledcom> wrote in message
news:3d49b872$1@news.povray.org...
> Ok, I'm following your cookbook, and so far so good.  I haven't tried a
> compile yet, but I got the Borland compiler, and the POV 3.5 source.
>
> There's a type under "Installing POV Source" item number 5.  It says:
>     Copy the file FRAME.H from C:\POVSRC to C:\MYGUIEXT
> I think it should read.
>     Copy the file FRAME.H from C:\POVSRC\SOURCE to C:\MYGUIEXT
>
> At least that's what it is for the 3.5 source.


I followed your advice for the compiler options and I was succesful in
getting it running!!! Yea!!!
With the 3.5 source FRAME.H is no longer required, but I updated the line
for 3.1 source.
I updated the cookbook with your suggestions.  I will not have much time
until next week to
do anymore coding/testing/headbanging but will definately welcome any more
comments you
are willing to share and will incorporate them into the cookbook most
ricki-tik.

Thanks to Ron and Chris for lending a hand as we learn how to program for
this.

Tom


Post a reply to this message

From: Andrew Wilcox
Subject: Re: How to Build a GUI Extension to POV-Ray for Windows.
Date: 7 Aug 2002 17:55:17
Message: <3d519745$2@news.povray.org>
If you want to suspend the warnings about args no used from BCC, put the
following #pragma before each method where these warnings are declared.

#pragma argsused

Man, makes compiling and debugging a little less painful. :-)

Also there's a news group for help with the command line tools.

http://info.borland.com/newsgroups/cppnewsdesc.html#cppide

Look at borland.public.cpp.commandlinetools.

That's where I found the tip above.

Andrew Wilcox


Post a reply to this message

From: Andrew Wilcox
Subject: Re: How to Build a GUI Extension to POV-Ray for Windows.
Date: 8 Aug 2002 14:15:32
Message: <3d52b544$1@news.povray.org>
Here's the code I wrote to save the Enabled status of my GUIEXT.
There are two methods SavePrefs(InstanceStruct) and
LoadPrefs(InstanceStruct).
You need to define REGKEY_ROOT near the top of your guiext.c file.
I put mine near the #define AUTHOR, and #define EMAIL.

Something like:
#define REGKEY_ROOT "Software\\MyCompany\\MyGUIEXT\\"

This is the key under HKCU where the registry keys will be placed.

I catch the error codes, but right now nothing is done with them.

What should I do if an error occurs during this process?  Just ignore it?
Set Enabled false?  Popup a error dialog to the user?  What's the desired
POV error handling approach for GUIEXTs?


void SavePrefs(InstanceStruct *Instance) {
   LONG error;
   DWORD dispositionValue;
   HKEY guiextHKey;
   DWORD value;

   error = RegCreateKeyEx( HKEY_CURRENT_USER,  // Parent hKey.
                           REGKEY_ROOT,        // Path to child.
                           0,                  // reserved
                           "",                 // Type of node to create,
ignored if entry already exists..
                           1,                  // Behavior options
(volatile/non-volatile).
                           KEY_ALL_ACCESS,     // Requested access to key.
                           NULL,               // Security structure that we
don't have.
                           &guiextHKey,        // The child's hKey.
                           &dispositionValue   // Whether the entry was
create or simply opened.
                         );

   value = Instance->Enabled ? 1 : 0;
   error = RegSetValueEx( guiextHKey,    // HKey to set the value on.
                          "Enabled",     // The name of the value under the
hkey to set the value on.
                          0,             // reserved.
                          REG_DWORD,
                          (BYTE*)&value,
                          4
                        );
   if(error != 0) {
      error = RegCloseKey(guiextHKey);
      Instance->Enabled = TRUE;
      SavePrefs(Instance);
   } else {
      error = RegCloseKey(guiextHKey);
      Instance->Enabled = (DWORD)*data;
   }


}

void LoadPrefs(InstanceStruct *Instance) {
   LONG error;
   DWORD dispositionValue;
   HKEY guiextHKey;
   DWORD type;
   DWORD length;
   char data[4];

   error = RegCreateKeyEx( HKEY_CURRENT_USER, // Parent hKey.
                           REGKEY_ROOT,       // Path to child.
                           0,                 // reserved
                           "",                // Type of node to create,
ignored if entry already exists..
                           1,                 // Behavior options
(volatile/non-volatile).
                           KEY_ALL_ACCESS,    // Requested access to key.
                           NULL,              // Security structure that we
don't have.
                           &guiextHKey,       // The child's hKey.
                           &dispositionValue
                         );

   error = RegQueryValueEx( guiextHKey, // HKey to set the value on.
                            "Enabled",  // The name of the value under the
hkey to set the value on.
                            0,          // reserved.
                            &type,
                            data,
                            &length
                          );
   error = RegCloseKey(guiextHKey);
   Instance->Enabled = (DWORD)*data;

}

DWORD WINAPI MenuSelect (IDataStruct *InstanceData, WPARAM Code)
{
   InstanceStruct        *Instance = (InstanceStruct *)
InstanceData->InstanceID ;
   ExternalVarStruct     ExternalVars;

   switch(Code) {
      case CM_ENABLED :
         Instance->Enabled = !Instance->Enabled ;
         CheckMenuItem (InstanceData->hMenu, CM_ENABLED +
InstanceData->FirstMenuItem, Instance->Enabled ? MF_CHECKED : MF_UNCHECKED)
;
         SavePrefs(Instance); // *** Here's where SavePrefs goes.
         return(0) ;
...
...

   // READ THIS FROM AN INI FILE ! it should be persistent.
   //Instance->Enabled = TRUE ;
   LoadPrefs(Instance);  // *** Here's where LoadPrefs goes.





--
#macro Q(A,E,W)box{-A/2,A/2pigment{rgb 9*W}translate E*A+W/1000}#end#macro
M(D,E)#local A=1/pow(3,D);#if(D<3)#local C=D+1;union{M(C,1)M(C,x+y)M(C,x+z)
M(C,y+z)M(C,x+y-z)M(C,x+z-y)M(C,y+z-x)M(C,x-y)M(C,z-x)M(C,y-z)M(C,y-x)M(C,
x-z)M(C,z-y)M(C,x-y-z)M(C,y-x-z)M(C,z-x-y)translate A*E}#else Q(A,E,x)Q(A,E
,y)Q(A,E,z)#end#end union{M(0,0)rotate<45,145,0>translate z*2}//Andrew


Post a reply to this message

From: Andrew Wilcox
Subject: Re: How to Build a GUI Extension to POV-Ray for Windows.
Date: 8 Aug 2002 18:40:35
Message: <3d52f363$1@news.povray.org>
Could someone in the know explain the concept of
  DisplayPlot;
  DisplayPlotRect
  WinPrePixel;
  WinPostPixel;
  WinAssignPixel;

I can log these events out to a file, so I see the order in which they are
called for each pixel as it is rendered.  I looked (briefly) at the windows
source code, but it wasn't obvious to me, how these are useful to a GUIEXT.
Do these allow me to somehow change the final colour that is assigned to an
individual pixel, or make a modification to the colour POV has calculated?
Could someone give me an example of why a GUIEXT would catch these events.

I understand WinSystem, BufferMessage, and DragFunction.   I'll probably ask
about ParseToolCommand later, since I don't forsee any need to mess with the
parser for my work.

And I want to again say thanks for the help Chris and Ron it is very very
much appreciated.

--
#macro Q(A,E,W)box{-A/2,A/2pigment{rgb 9*W}translate E*A+W/1000}#end#macro
M(D,E)#local A=1/pow(3,D);#if(D<3)#local C=D+1;union{M(C,1)M(C,x+y)M(C,x+z)
M(C,y+z)M(C,x+y-z)M(C,x+z-y)M(C,y+z-x)M(C,x-y)M(C,z-x)M(C,y-z)M(C,y-x)M(C,
x-z)M(C,z-y)M(C,x-y-z)M(C,y-x-z)M(C,z-x-y)translate A*E}#else Q(A,E,x)Q(A,E
,y)Q(A,E,z)#end#end union{M(0,0)rotate<45,145,0>translate z*2}//Andrew


Post a reply to this message

From: Chris Cason
Subject: Re: How to Build a GUI Extension to POV-Ray for Windows.
Date: 12 Aug 2002 14:28:25
Message: <3d57fe49@news.povray.org>
"Andrew Wilcox" <awi### [at] unpuzzledcom> wrote in message
news:3d52f363$1@news.povray.org...
> Could someone in the know explain the concept of
>   DisplayPlot;

Called when a pixel is plotted to the display. Not called if running with -d.

>   DisplayPlotRect

called as above, except for mosaic preview.

>   WinPrePixel;

called before each pixel is plotted or written to a file, regardless of -d. you
can change the color info here (before the pixel is rendered).

>   WinPostPixel;

ditto, but afterwards (you can change it as well).

>   WinAssignPixel;

this gives you the actual color data that is finally written to the output file.

-- Chris


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.