You can subscribe to this list here.
| 2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
| 2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
| 2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
| 2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
| 2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
|
From: <kr_...@us...> - 2003-02-10 22:42:15
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src/include Modified Files: Internals.h Types.h Window.h Log Message: MDI/SDI interface for Windows Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Internals.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Internals.h 27 Jan 2003 21:18:32 -0000 1.3 --- Internals.h 10 Feb 2003 22:42:11 -0000 1.4 *************** *** 12,15 **** --- 12,20 ---- extern HMODULE ghModule; extern HFONT ghControlFont; + extern int gDocumentInterface; + extern HWND ghWndFrame; + extern HWND ghWndClient; + extern DWORD gActiveObjects; + extern LPCSTR gAppName; extern WindowHandle checkWindow(HWND hWnd, char *className); *************** *** 29,33 **** extern void rfree(void *ptr); extern void *rmalloc(unsigned long bytes); - extern void initGUI(); #endif --- 34,37 ---- Index: Types.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Types.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Types.h 3 Feb 2003 16:53:41 -0000 1.4 --- Types.h 10 Feb 2003 22:42:11 -0000 1.5 *************** *** 114,117 **** --- 114,118 ---- #endif + extern void osInit(char *AppName, int DocumentInterface); extern void osStart(); extern void osQuit(); Index: Window.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Window.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Window.h 23 Jan 2003 20:19:32 -0000 1.2 --- Window.h 10 Feb 2003 22:42:11 -0000 1.3 *************** *** 63,67 **** WindowHandle osCreateWindow(); WindowHandle osCreateDialog(WindowHandle parent); - WindowHandle osCreateMDIWindow(WindowHandle parent); void osSetWindowColor(WindowHandle window, int foreColor, int backColor, int hatchStyle, BitmapHandle patBmp); char *osGetWindowTitle(WindowHandle window); --- 63,66 ---- *************** *** 77,81 **** void osGetWindowLineSize(WindowHandle window, int *res); void osSetWindowLineSize(WindowHandle window, int cx, int cy); ! void osCloseWindow(WindowHandle window); CanvasHandle osGetWindowCanvas(WindowHandle window); void osReleaseWindowCanvas(WindowHandle window,CanvasHandle canvas); --- 76,81 ---- void osGetWindowLineSize(WindowHandle window, int *res); void osSetWindowLineSize(WindowHandle window, int cx, int cy); ! BOOL osDismissWindow(WindowHandle window); ! void osDestroyWindow(WindowHandle window); CanvasHandle osGetWindowCanvas(WindowHandle window); void osReleaseWindowCanvas(WindowHandle window,CanvasHandle canvas); |
|
From: <kr_...@us...> - 2003-02-10 22:42:14
|
Update of /cvsroot/htoolkit/port/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src/examples
Modified Files:
ByeDemo.hs
Log Message:
MDI/SDI interface for Windows
Index: ByeDemo.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/examples/ByeDemo.hs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ByeDemo.hs 8 Feb 2003 08:39:35 -0000 1.3
--- ByeDemo.hs 10 Feb 2003 22:42:11 -0000 1.4
***************
*** 11,21 ****
import Graphics.UI.Port
! main = do demo -- setup gui
! start -- start event loop
demo :: IO ()
demo
= do w <- createWindow
- registerWindowDismiss w (closeWindow w) -- close when the user dismisses the window
setWindowDomainSize w (sz 0 0) -- no scroll bars needed
setWindowViewSize w (sz 80 40) -- guess some size as Port has no layout manager
--- 11,19 ----
import Graphics.UI.Port
! main = start SDI demo
demo :: IO ()
demo
= do w <- createWindow
setWindowDomainSize w (sz 0 0) -- no scroll bars needed
setWindowViewSize w (sz 80 40) -- guess some size as Port has no layout manager
|
|
From: <kr_...@us...> - 2003-02-08 08:39:39
|
Update of /cvsroot/htoolkit/port/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv28423/src/examples
Modified Files:
ByeDemo.hs
Log Message:
Update the example after last changes in Port library
Index: ByeDemo.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/examples/ByeDemo.hs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ByeDemo.hs 31 Jan 2003 23:27:24 -0000 1.2
--- ByeDemo.hs 8 Feb 2003 08:39:35 -0000 1.3
***************
*** 17,25 ****
demo
= do w <- createWindow
- registerWindow w -- register for proper shutdown
registerWindowDismiss w (closeWindow w) -- close when the user dismisses the window
! registerWindowPaint w (\can upd -> fillRect upd can) -- fill the background with some color
! setWindowDomainSize w (Size 0 0) -- no scroll bars needed
! setWindowViewSize w (Size 80 40) -- guess some size as Port has no layout manager
setWindowTitle w "Bye!" -- set the title bar text
--- 17,23 ----
demo
= do w <- createWindow
registerWindowDismiss w (closeWindow w) -- close when the user dismisses the window
! setWindowDomainSize w (sz 0 0) -- no scroll bars needed
! setWindowViewSize w (sz 80 40) -- guess some size as Port has no layout manager
setWindowTitle w "Bye!" -- set the title bar text
***************
*** 27,36 ****
setLabelText l "Hello World!"
lsize <- getLabelRequestSize l -- get the minimal size of the label
! moveResizeControl l (rectAt (Point 0 0) lsize) -- position in upperleft corner
b <- createButton w
setButtonText b "Bye"
bsize <- getButtonRequestSize b -- get the minimal size of the button
! moveResizeControl b (rectAt (Point 0 (sh lsize)) bsize) -- position under the label
registerButtonClick b (bye w l b) -- register event handler
--- 25,34 ----
setLabelText l "Hello World!"
lsize <- getLabelRequestSize l -- get the minimal size of the label
! moveResizeControl l (rectAt (pt 0 0) lsize) -- position in upperleft corner
b <- createButton w
setButtonText b "Bye"
bsize <- getButtonRequestSize b -- get the minimal size of the button
! moveResizeControl b (rectAt (pt 0 (sh lsize)) bsize) -- position under the label
registerButtonClick b (bye w l b) -- register event handler
|
|
From: <kr_...@us...> - 2003-02-08 08:38:11
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv27790a/src/Port
Modified Files:
Window.hs
Log Message:
Add default handlers for Paint event.
Index: Window.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Window.hs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Window.hs 23 Jan 2003 20:19:32 -0000 1.3
--- Window.hs 8 Feb 2003 08:38:08 -0000 1.4
***************
*** 39,42 ****
--- 39,43 ----
import Foreign.Marshal.Alloc
import Graphics.UI.Port.Types
+ import Graphics.UI.Port.Canvas(initCanvas, doneCanvas, defaultPen, dialogPen)
import Graphics.UI.Port.Handlers( registerWindow, registerWindowPaint )
***************
*** 73,77 ****
--- 74,83 ----
= do hwnd <- osCreateWindow
registerWindow hwnd
+ registerWindowPaint hwnd onpaint
return hwnd
+ where
+ onpaint canvas rect = do
+ initCanvas defaultPen UnBuffered canvas
+ doneCanvas canvas
foreign import ccall osCreateWindow :: IO WindowHandle
***************
*** 81,85 ****
--- 87,96 ----
= do hwnd <- osCreateDialog hparent
registerWindow hwnd
+ registerWindowPaint hwnd onpaint
return hwnd
+ where
+ onpaint canvas rect = do
+ initCanvas dialogPen UnBuffered canvas
+ doneCanvas canvas
foreign import ccall osCreateDialog :: WindowHandle -> IO WindowHandle
|
|
From: <kr_...@us...> - 2003-02-08 08:36:19
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv27364/src/Port
Modified Files:
Canvas.hs
Log Message:
Add definition of dialogPen from HToolkit to Port library. Add instance of Eq for Pen data type.
Index: Canvas.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Canvas.hs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Canvas.hs 3 Feb 2003 16:53:40 -0000 1.11
--- Canvas.hs 8 Feb 2003 08:36:14 -0000 1.12
***************
*** 42,46 ****
-- * Pen
! , Pen(..), defaultPen
-- ** Font
--- 42,46 ----
-- * Pen
! , Pen(..), defaultPen, dialogPen
-- ** Font
***************
*** 79,89 ****
, penHatchStyle :: !HatchStyle
}
-- | Create a pen with default drawing values. That is:
--
! -- 'Pen'@ 1 @'DrawCopy'@ @'black'@ @'defaultFont'@ @'JoinRound'@ @'CapRound'@ @'LineSolid'@ @'HatchSolid'@ @'white'
defaultPen :: Pen
defaultPen
! = Pen 1 DrawCopy black white False defaultFont JoinRound CapRound LineSolid HatchSolid
--- 79,98 ----
, penHatchStyle :: !HatchStyle
}
+ deriving Eq
-- | Create a pen with default drawing values. That is:
--
! -- @'Pen'@ 1 @'DrawCopy'@ @'black'@ @'white'@ @'False'@ @'defaultFont'@ @'JoinMiter'@ @'CapFlat'@ @'LineSolid'@ @'HatchSolid'@
defaultPen :: Pen
defaultPen
! = Pen 1 DrawCopy black white False defaultFont JoinMiter CapFlat LineSolid HatchSolid
!
! -- | Create a pen with default drawing values for dialogs. That is:
! --
! -- @'Pen'@ 1 @'DrawCopy'@ @'black'@ @'dialoggrey'@ @'False'@ @'dialogFont'@ @'JoinMiter'@ @'CapFlat'@ @'LineSolid'@ @'HatchSolid'@
! dialogPen :: Pen
! dialogPen
! = Pen 1 DrawCopy black dialoggrey False dialogFont JoinMiter CapFlat LineSolid HatchSolid
!
|
|
From: <kr_...@us...> - 2003-02-08 08:32:56
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv26252/src/Graphics/UI/GIO
Modified Files:
Canvas.hs
Log Message:
The pen attribute setter will call changeCanvasPen only when the new pen is different from the old pen.
Index: Canvas.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Canvas.hs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Canvas.hs 3 Feb 2003 16:53:41 -0000 1.4
--- Canvas.hs 8 Feb 2003 08:32:53 -0000 1.5
***************
*** 89,94 ****
where
getter c = getVar (vpen c)
! setter c p = do takeVar (vpen c)
! Port.changeCanvasPen p (hcanvas c)
putVar (vpen c) p
--- 89,94 ----
where
getter c = getVar (vpen c)
! setter c p = do oldpen <- takeVar (vpen c)
! when (p /= oldpen) (Port.changeCanvasPen p (hcanvas c))
putVar (vpen c) p
|
|
From: <kr_...@us...> - 2003-02-03 16:53:46
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv13436/gio/src/Graphics/UI/GIO
Modified Files:
Canvas.hs
Log Message:
The implementation of Canvas are changed for better performance. setPenColor, setPenBackColor, setPenHatchStyle and all other setPen* functions are replaced with single function which changes all attributes of Canvas in single step.
Index: Canvas.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Canvas.hs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Canvas.hs 30 Jan 2003 23:58:30 -0000 1.3
--- Canvas.hs 3 Feb 2003 16:53:41 -0000 1.4
***************
*** 89,111 ****
where
getter c = getVar (vpen c)
! setter c p = do let h = hcanvas c
! oldp <- takeVar (vpen c)
! when (penColor oldp /= penColor p)
! (Port.setPenColor (penColor p) h)
! when (penSize oldp /= penSize p)
! (Port.setPenSize (penSize p) h)
! when (penFont oldp /= penFont p)
! (Port.setPenFont (penFont p) h)
! when (penMode oldp /= penMode p)
! (Port.setPenDrawMode (penMode p) h)
! when (penJoinStyle oldp /= penJoinStyle p)
! (Port.setPenJoinStyle (penJoinStyle p) h)
! when (penHatchStyle oldp /= penHatchStyle p)
! (Port.setPenHatchStyle (penHatchStyle p) h)
! when (penCapStyle oldp /= penCapStyle p)
! (Port.setPenCapStyle (penCapStyle p) h)
! when (penLineStyle oldp /= penLineStyle p)
! (Port.setPenLineStyle (penLineStyle p) h)
! putVar (vpen c) p
-- | The current drawing color.
--- 89,95 ----
where
getter c = getVar (vpen c)
! setter c p = do takeVar (vpen c)
! Port.changeCanvasPen p (hcanvas c)
! putVar (vpen c) p
-- | The current drawing color.
|
|
From: <kr_...@us...> - 2003-02-03 16:53:45
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv13436/port/src/cbits/Win32
Modified Files:
Canvas.c
Log Message:
The implementation of Canvas are changed for better performance. setPenColor, setPenBackColor, setPenHatchStyle and all other setPen* functions are replaced with single function which changes all attributes of Canvas in single step.
Index: Canvas.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Canvas.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Canvas.c 30 Jan 2003 20:43:25 -0000 1.5
--- Canvas.c 3 Feb 2003 16:53:41 -0000 1.6
***************
*** 53,63 ****
\*------------------------------------*/
- #define DRAWING 0
- #define UNDRAWING 1
- #define FILLING 2
- #define ERASING 4
-
- static void SetLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas);
-
void osInitCanvas (int size, int function,
unsigned int pcolor,
--- 53,56 ----
***************
*** 78,99 ****
RECT clipRect;
- canvas->penSize = size;
- canvas->joinStyle = joinStyle;
- canvas->capStyle = capStyle;
- canvas->lineStyle = 0;
canvas->stylesCount = 0;
canvas->stylesPtr = NULL;
! canvas->penColor = pcolor;
! canvas->backColor = bcolor;
! canvas->lastActivity = FILLING;
! canvas->theNormalPen = NULL;
! canvas->theBackPen = NULL;
! canvas->theBackBrush = NULL;
! canvas->theNormalBrush = NULL;
canvas->theFont = NULL;
- canvas->hatchStyle = hatchStyle;
- canvas->patBmp = patBmp;
-
- SetLineStyle(lineStyle,stylesCount,stylesPtr,canvas);
SaveDC(canvas->hDC);
--- 71,79 ----
RECT clipRect;
canvas->stylesCount = 0;
canvas->stylesPtr = NULL;
! canvas->thePen = NULL;
! canvas->theBrush = NULL;
canvas->theFont = NULL;
SaveDC(canvas->hDC);
***************
*** 130,150 ****
SetTextAlign (canvas->hDC, TA_LEFT | TA_BASELINE);
SetStretchBltMode (canvas->hDC,COLORONCOLOR);
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! osSetBackColor (canvas->backColor, canvas);
! osSetPenColor (canvas->penColor, canvas);
! osSetFont (font, canvas);
! osSetPenFunction(function, canvas);
if (canvas->bInvalidated)
{
SetBkMode(canvas->hDC, OPAQUE);
! SetBkColor (canvas->hDC, canvas->penColor);
SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! SelectObject(canvas->hDC, canvas->theBackBrush);
Rectangle(canvas->hDC, clipRect.left, clipRect.top, clipRect.right+1, clipRect.bottom+1);
- }
! osSetBkDrawMode(bkMode, canvas);
} /* osInitCanvas */
--- 110,138 ----
SetTextAlign (canvas->hDC, TA_LEFT | TA_BASELINE);
SetStretchBltMode (canvas->hDC,COLORONCOLOR);
! osChangeCanvasPen(size,function,pcolor,bcolor,joinStyle,capStyle,lineStyle,stylesCount,stylesPtr,bkMode,hatchStyle,patBmp,font,canvas);
if (canvas->bInvalidated)
{
+ HBRUSH hb;
+ LOGBRUSH lb;
+
+ lb.lbColor = bcolor;
+ SetupLogBrush(&lb, FALSE, hatchStyle, patBmp);
+ hb = CreateBrushIndirect(&lb);
+
SetBkMode(canvas->hDC, OPAQUE);
! SetBkColor (canvas->hDC, pcolor);
SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! SelectObject (canvas->hDC, hb);
!
Rectangle(canvas->hDC, clipRect.left, clipRect.top, clipRect.right+1, clipRect.bottom+1);
! SelectObject (canvas->hDC, canvas->theBrush);
! SelectObject (canvas->hDC, canvas->thePen);
! if (!bkMode) SetBkMode(canvas->hDC, TRANSPARENT);
!
! DeleteObject(hb);
! }
} /* osInitCanvas */
***************
*** 177,186 ****
RestoreDC (canvas->hDC, -1);
! SetLineStyle(0,0,NULL,canvas);
! DeleteObject (canvas->theNormalPen);
! DeleteObject (canvas->theBackPen);
! DeleteObject (canvas->theNormalBrush);
! DeleteObject (canvas->theBackBrush);
} /* osDoneCanvas */
--- 165,173 ----
RestoreDC (canvas->hDC, -1);
! if (canvas->stylesPtr)
! free(canvas->stylesPtr);
! DeleteObject (canvas->thePen);
! DeleteObject (canvas->theBrush);
} /* osDoneCanvas */
***************
*** 214,337 ****
} /* osDeletePolygon */
-
- static void StartDrawing (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case UNDRAWING:
- SelectObject (canvas->hDC, canvas->theNormalPen);
- SetTextColor(canvas->hDC, canvas->penColor);
- break;
- case FILLING:
- SelectObject (canvas->hDC, canvas->theNormalPen);
- SetTextColor(canvas->hDC, canvas->penColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- case ERASING:
- SelectObject (canvas->hDC, canvas->theNormalPen);
- SetTextColor(canvas->hDC, canvas->penColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- }
- canvas->lastActivity = DRAWING;
- } /* StartDrawing */
-
- static void StartFilling (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case DRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theNormalBrush);
- break;
- case UNDRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theNormalBrush);
- break;
- case ERASING:
- SelectObject (canvas->hDC, canvas->theNormalBrush);
- break;
- }
- canvas->lastActivity = FILLING;
- } /* StartFilling */
-
- static void StartErasing (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case UNDRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theBackBrush);
- break;
- case DRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theBackBrush);
- break;
- case FILLING:
- SelectObject (canvas->hDC, canvas->theBackBrush);
- break;
- }
- canvas->lastActivity = ERASING;
- } /* StartErasing */
-
-
- static void StartUndrawing (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case DRAWING:
- SelectObject (canvas->hDC, canvas->theBackPen);
- SetTextColor (canvas->hDC, canvas->backColor);
- break;
- case FILLING:
- SelectObject (canvas->hDC, canvas->theBackPen);
- SetTextColor (canvas->hDC, canvas->backColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- case ERASING:
- SelectObject (canvas->hDC, canvas->theBackPen);
- SetTextColor (canvas->hDC, canvas->backColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- }
- canvas->lastActivity = UNDRAWING;
- } /* StartUndrawing */
-
- static int GetPenStyle(CanvasHandle canvas)
- {
- DWORD style;
-
- //if (canvas->penSize == 1 && canvas->lineStyle != PS_USERSTYLE)
- //style = PS_COSMETIC;
- //else
- style = PS_GEOMETRIC;
-
- switch (canvas->lineStyle)
- {
- case 0: style |= (canvas->penSize == 1) ? PS_SOLID : PS_INSIDEFRAME; break;
- case 1: style |= PS_DASH; break;
- case 2: style |= PS_DOT; break;
- case 3: style |= PS_DASHDOT; break;
- case 4: style |= PS_DASHDOTDOT; break;
- case 5: style |= PS_USERSTYLE; break;
- }
-
- switch (canvas->joinStyle)
- {
- case 0: style |= PS_JOIN_BEVEL; break;
- case 1: style |= PS_JOIN_MITER; break;
- case 2: style |= PS_JOIN_ROUND; break;
- }
-
- switch (canvas->capStyle)
- {
- case 0: style |= PS_ENDCAP_ROUND; break;
- case 1: style |= PS_ENDCAP_SQUARE; break;
- case 2: style |= PS_ENDCAP_FLAT; break;
- }
-
- return style;
- }
-
void SetupLogBrush(LOGBRUSH *plb, BOOL bSetSolid, int hatchStyle, BitmapHandle patBmp)
{
--- 201,204 ----
***************
*** 373,450 ****
}
- static void ChangeTheNormalPen (CanvasHandle canvas)
- {
- HPEN hp;
- LOGBRUSH lb;
-
- lb.lbColor = canvas->penColor;
- SetupLogBrush(&lb, canvas->penSize == 1, canvas->hatchStyle, canvas->patBmp);
- hp = ExtCreatePen (GetPenStyle(canvas), canvas->penSize, &lb, canvas->stylesCount, canvas->stylesPtr);
-
- if (canvas->lastActivity == DRAWING)
- SelectObject (canvas->hDC, hp);
- if (canvas->theNormalPen)
- DeleteObject (canvas->theNormalPen);
! canvas->theNormalPen = hp;
! } /* ChangeTheNormalPen */
! static void ChangeTheBackPen (CanvasHandle canvas)
{
HPEN hp;
- LOGBRUSH lb;
-
- lb.lbColor = canvas->backColor;
- SetupLogBrush(&lb, canvas->penSize == 1, canvas->hatchStyle, canvas->patBmp);
- hp = ExtCreatePen (GetPenStyle(canvas), canvas->penSize, &lb, canvas->stylesCount, canvas->stylesPtr);
-
- if (canvas->lastActivity == UNDRAWING)
- SelectObject (canvas->hDC, hp);
- if (canvas->theBackPen)
- DeleteObject (canvas->theBackPen);
-
- canvas->theBackPen = hp;
- } /* ChangeTheBackPen */
-
- static void ChangeTheNormalBrush (CanvasHandle canvas)
- {
HBRUSH hb;
LOGBRUSH lb;
!
! lb.lbColor = canvas->penColor;
! SetupLogBrush(&lb, FALSE, canvas->hatchStyle, canvas->patBmp);
! hb = CreateBrushIndirect(&lb);
!
! if (canvas->lastActivity == FILLING)
! SelectObject (canvas->hDC, hb);
! if (canvas->theNormalBrush)
! DeleteObject (canvas->theNormalBrush);
!
! canvas->theNormalBrush = hb;
! } /* ChangeTheNormalBrush */
!
! static void ChangeTheBackBrush (CanvasHandle canvas)
! {
! HBRUSH hb;
! LOGBRUSH lb;
!
! lb.lbColor = canvas->backColor;
! SetupLogBrush(&lb, FALSE, canvas->hatchStyle, canvas->patBmp);
! hb = CreateBrushIndirect(&lb);
!
! if (canvas->lastActivity == ERASING)
! SelectObject (canvas->hDC, hb);
! if (canvas->theBackBrush)
! DeleteObject (canvas->theBackBrush);
!
! canvas->theBackBrush = hb;
! } /* ChangeTheBackBrush */
!
! static void SetLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas)
! {
int i;
- canvas->lineStyle = lineStyle;
-
if (canvas->stylesPtr)
free(canvas->stylesPtr);
--- 240,269 ----
}
! /*------------------------------------*\
! | Interface functions |
! \*------------------------------------*/
! void osChangeCanvasPen(int size, int function,
! unsigned int pcolor,
! unsigned int bcolor,
! int joinStyle,
! int capStyle,
! int lineStyle,
! int stylesCount,
! unsigned char *stylesPtr,
! BOOL bkMode,
! int hatchStyle,
! BitmapHandle patBmp,
! FontHandle font,
! CanvasHandle canvas
! )
{
HPEN hp;
HBRUSH hb;
LOGBRUSH lb;
! DWORD penstyle;
int i;
if (canvas->stylesPtr)
free(canvas->stylesPtr);
***************
*** 465,541 ****
canvas->stylesPtr = NULL;
}
- }
-
- /*------------------------------------*\
- | Interface functions |
- \*------------------------------------*/
-
- void osSetPenSize (int size, CanvasHandle canvas)
- {
- canvas->penSize = size;
- ChangeTheNormalPen (canvas);
- ChangeTheBackPen (canvas);
- } /* osSetPenSize */
-
- void osSetPenColor (unsigned int color, CanvasHandle canvas)
- {
- canvas->penColor = color;
-
- ChangeTheNormalPen (canvas);
- ChangeTheNormalBrush (canvas);
-
- if (canvas->lastActivity == DRAWING)
- SetTextColor(canvas->hDC, canvas->penColor);
- } /* osSetPenColor */
-
- void osSetBackColor (unsigned int color, CanvasHandle canvas)
- {
- canvas->backColor = color;
! ChangeTheBackPen (canvas);
! ChangeTheBackBrush (canvas);
! SetBkColor (canvas->hDC, canvas->backColor);
! if (canvas->lastActivity == UNDRAWING)
! SetTextColor(canvas->hDC, canvas->backColor);
! } /* osSetBackColor */
! void osSetPenJoinStyle(int joinStyle, CanvasHandle canvas)
! {
! canvas->joinStyle = joinStyle;
! ChangeTheNormalPen(canvas);
! ChangeTheBackPen(canvas);
! } /* osSetPenJoinStyle */
! void osSetPenCapStyle(int capStyle, CanvasHandle canvas)
! {
! canvas->capStyle = capStyle;
! ChangeTheNormalPen(canvas);
! ChangeTheBackPen(canvas);
! } /* osSetPenCapStyle */
! void osSetPenLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas)
! {
! if (canvas->stylesPtr)
! free(canvas->stylesPtr);
! SetLineStyle(lineStyle,stylesCount,stylesPtr,canvas);
! ChangeTheNormalPen(canvas);
! ChangeTheBackPen(canvas);
! } /* osSetPenLineStyle */
! void osSetPenHatchStyle(int hatchStyle, BitmapHandle patBmp, CanvasHandle canvas)
! {
! canvas->hatchStyle = hatchStyle;
! canvas->patBmp = patBmp;
! ChangeTheNormalPen(canvas);
! ChangeTheNormalBrush(canvas);
! ChangeTheBackPen(canvas);
! ChangeTheBackBrush(canvas);
! } /* osSetPenHatchStyle */
- void osSetPenFunction(int function, CanvasHandle canvas)
- {
switch (function)
{
--- 284,335 ----
canvas->stylesPtr = NULL;
}
! //if (penSize == 1 && lineStyle != PS_USERSTYLE)
! //penstyle = PS_COSMETIC;
! //else
! penstyle = PS_GEOMETRIC;
! switch (lineStyle)
! {
! case 0: penstyle |= (size == 1) ? PS_SOLID : PS_INSIDEFRAME; break;
! case 1: penstyle |= PS_DASH; break;
! case 2: penstyle |= PS_DOT; break;
! case 3: penstyle |= PS_DASHDOT; break;
! case 4: penstyle |= PS_DASHDOTDOT; break;
! case 5: penstyle |= PS_USERSTYLE; break;
! }
! switch (joinStyle)
! {
! case 0: penstyle |= PS_JOIN_BEVEL; break;
! case 1: penstyle |= PS_JOIN_MITER; break;
! case 2: penstyle |= PS_JOIN_ROUND; break;
! }
! switch (capStyle)
! {
! case 0: penstyle |= PS_ENDCAP_ROUND; break;
! case 1: penstyle |= PS_ENDCAP_SQUARE; break;
! case 2: penstyle |= PS_ENDCAP_FLAT; break;
! }
! lb.lbColor = pcolor;
! SetupLogBrush(&lb, size == 1, hatchStyle, patBmp);
! hp = ExtCreatePen (penstyle, size, &lb, canvas->stylesCount, canvas->stylesPtr);
! SelectObject (canvas->hDC, hp);
! if (canvas->thePen)
! DeleteObject (canvas->thePen);
! canvas->thePen = hp;
! lb.lbColor = pcolor;
! SetupLogBrush(&lb, FALSE, hatchStyle, patBmp);
! hb = CreateBrushIndirect(&lb);
! SelectObject (canvas->hDC, hb);
! if (canvas->theBrush)
! DeleteObject(canvas->theBrush);
! canvas->theBrush = hb;
switch (function)
{
***************
*** 544,553 ****
case 2: SetROP2 (canvas->hDC, R2_XORPEN); break;
}
- } /* osSetPenFunction */
! void osSetBkDrawMode(BOOL mode, CanvasHandle canvas)
! {
! SetBkMode(canvas->hDC, mode ? OPAQUE : TRANSPARENT);
! }
void osRotateCanvas(double angle, CanvasHandle canvas)
--- 338,347 ----
case 2: SetROP2 (canvas->hDC, R2_XORPEN); break;
}
! SetTextColor(canvas->hDC, pcolor);
! SetBkColor(canvas->hDC, bcolor);
!
! SetBkMode(canvas->hDC, bkMode ? OPAQUE : TRANSPARENT);
! };
void osRotateCanvas(double angle, CanvasHandle canvas)
***************
*** 599,620 ****
void osDrawPoint (int x, int y, CanvasHandle canvas)
{
! SetPixelV (canvas->hDC, x, y, canvas->penColor); // (for printing)
} /* osDrawPoint */
- void osUndrawPoint (int x, int y, CanvasHandle canvas)
- {
- SetPixelV (canvas->hDC, x, y, canvas->backColor); // (for printing)
- } /* osUndrawPoint */
-
void osDrawLine (int startx, int starty, int endx, int endy, CanvasHandle canvas)
{
- StartDrawing (canvas);
- MoveToEx (canvas->hDC, startx, starty, NULL);
- LineTo (canvas->hDC, endx, endy);
- } /* osDrawLine */
-
- void osUndrawLine (int startx, int starty, int endx, int endy, CanvasHandle canvas)
- {
- StartUndrawing(canvas);
MoveToEx (canvas->hDC, startx, starty, NULL);
LineTo (canvas->hDC, endx, endy);
--- 393,401 ----
void osDrawPoint (int x, int y, CanvasHandle canvas)
{
! SetPixelV (canvas->hDC, x, y, GetTextColor(canvas->hDC));
} /* osDrawPoint */
void osDrawLine (int startx, int starty, int endx, int endy, CanvasHandle canvas)
{
MoveToEx (canvas->hDC, startx, starty, NULL);
LineTo (canvas->hDC, endx, endy);
***************
*** 623,675 ****
void osDrawChar (int x, int y, char c, CanvasHandle canvas)
{
- StartDrawing (canvas);
TextOut (canvas->hDC, x, y, &c, 1);
} /* osDrawChar */
- void osUndrawChar (int x, int y, char c, CanvasHandle canvas)
- {
- StartUndrawing(canvas);
- TextOut (canvas->hDC, x, y, &c, 1);
- } /* osEraseChar */
-
void osDrawString (int x, int y, char *string, CanvasHandle canvas)
{
- StartDrawing (canvas);
TextOut (canvas->hDC, x, y, string, strlen(string));
} /* osDrawString */
- void osUndrawString (int x, int y, char *string, CanvasHandle canvas)
- {
- StartUndrawing(canvas);
- TextOut (canvas->hDC, x, y, string, strlen(string));
- } /* osEraseString */
-
-
void osDrawRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! StartDrawing (canvas);
! Rectangle (canvas->hDC, left, top, right, bot);
} /* osDrawRect */
- void osUndrawRect(int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
- Rectangle (canvas->hDC, left, top, right, bot);
- } /* osUndrawRect */
-
void osFillRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! StartFilling (canvas);
! Rectangle (canvas->hDC, left, top, right + 1, bot + 1);
} /* osFillRect */
- void osEraseRect(int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartErasing (canvas);
- Rectangle (canvas->hDC, left, top, right + 1, bot + 1);
- } /* osEraseRect */
-
! static void winDrawCurve(BOOL fill, int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
float rx,ry;
--- 404,431 ----
void osDrawChar (int x, int y, char c, CanvasHandle canvas)
{
TextOut (canvas->hDC, x, y, &c, 1);
} /* osDrawChar */
void osDrawString (int x, int y, char *string, CanvasHandle canvas)
{
TextOut (canvas->hDC, x, y, string, strlen(string));
} /* osDrawString */
void osDrawRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
! Rectangle (canvas->hDC, left, top, right+1, bot+1);
! SelectObject (canvas->hDC, canvas->theBrush);
} /* osDrawRect */
void osFillRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! Rectangle(canvas->hDC, left, top, right+2, bot+2);
! SelectObject (canvas->hDC, canvas->thePen);
} /* osFillRect */
! static void osDrawFillCurve(BOOL fill, int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
float rx,ry;
***************
*** 677,686 ****
int fx,fy;
int tx,ty;
!
rx = abs(x1-x0)/2;
ry = abs(y1-y0)/2;
cx = x0 + rx;
cy = y0 + ry;
!
fx = floor(cx + cos(from)*rx);
fy = floor(cy - sin(from)*ry);
--- 433,442 ----
int fx,fy;
int tx,ty;
!
rx = abs(x1-x0)/2;
ry = abs(y1-y0)/2;
cx = x0 + rx;
cy = y0 + ry;
!
fx = floor(cx + cos(from)*rx);
fy = floor(cy - sin(from)*ry);
***************
*** 688,722 ****
ty = floor(cy - sin(to)*ry);
! if (fill) {
! if (clockwise) Pie (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy );
! else Pie (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty );
! }
! else {
! if (clockwise) Arc (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy );
! else Arc (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty );
! }
} /* osDrawCurve */
void osDrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! StartDrawing(canvas);
! winDrawCurve(FALSE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osDrawCurve */
- void osUndrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
- {
- StartUndrawing(canvas);
- winDrawCurve(FALSE,x0,y0,x1,y1,from,to,clockwise,canvas);
- } /* osUndrawCurve */
-
void osDrawOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
- StartDrawing (canvas);
- Arc (canvas->hDC, left, top, right, bot, 0, 0, 0, 0);
- } /* osDrawOval */
-
- void osUndrawOval (int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
Arc (canvas->hDC, left, top, right, bot, 0, 0, 0, 0);
} /* osDrawOval */
--- 444,470 ----
ty = floor(cy - sin(to)*ry);
! if (fill)
! {
! if (clockwise)
! Pie (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy);
! else
! Pie (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty);
! }
! else
! {
! if (clockwise)
! Arc (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy);
! else
! Arc (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty);
! }
} /* osDrawCurve */
void osDrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! osDrawFillCurve(FALSE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osDrawCurve */
void osDrawOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
Arc (canvas->hDC, left, top, right, bot, 0, 0, 0, 0);
} /* osDrawOval */
***************
*** 724,759 ****
void osFillOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
- StartFilling (canvas);
Ellipse (canvas->hDC, left, top, right + 1, bot + 1);
} /* osFillOval */
- void osEraseOval (int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartErasing (canvas);
- Ellipse (canvas->hDC, left, top, right + 1, bot + 1);
- } /* osEraseOval */
-
-
void osFillCurve(int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! StartFilling (canvas);
! winDrawCurve(TRUE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osFillCurve */
- void osEraseCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
- {
- StartErasing (canvas);
- winDrawCurve(TRUE,x0,y0,x1,y1,from,to,clockwise,canvas);
- } /* osEraseCurve */
-
void osDrawPolyline (PolygonHandle arr, CanvasHandle canvas)
{
- StartDrawing (canvas);
- Polyline (canvas->hDC, arr->data, arr->count);
- } /* osDrawPolygon */
-
- void osUndrawPolyline (PolygonHandle arr, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
Polyline (canvas->hDC, arr->data, arr->count);
} /* osDrawPolygon */
--- 472,485 ----
void osFillOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
Ellipse (canvas->hDC, left, top, right + 1, bot + 1);
} /* osFillOval */
void osFillCurve(int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! osDrawFillCurve(TRUE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osFillCurve */
void osDrawPolyline (PolygonHandle arr, CanvasHandle canvas)
{
Polyline (canvas->hDC, arr->data, arr->count);
} /* osDrawPolygon */
***************
*** 761,771 ****
void osDrawPolygon (PolygonHandle arr, CanvasHandle canvas)
{
- StartDrawing (canvas);
- Polygon (canvas->hDC, arr->data, arr->count);
- } /* osDrawPolygon */
-
- void osUndrawPolygon (PolygonHandle arr, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
Polygon (canvas->hDC, arr->data, arr->count);
} /* osDrawPolygon */
--- 487,490 ----
***************
*** 773,785 ****
void osFillPolygon (PolygonHandle arr, CanvasHandle canvas)
{
- StartFilling (canvas);
Polygon (canvas->hDC, arr->data, arr->count);
} /* osFillPolygon */
-
- void osErasePolygon (PolygonHandle arr, CanvasHandle canvas)
- {
- StartErasing (canvas);
- Polygon (canvas->hDC, arr->data, arr->count);
- } /* osErasePolygon */
/* PA: two new routines that temporarily create and destroy a DISPLAY CanvasHandle.
--- 492,497 ----
|
|
From: <kr_...@us...> - 2003-02-03 16:53:45
|
Update of /cvsroot/htoolkit/port/src/include
In directory sc8-pr-cvs1:/tmp/cvs-serv13436/port/src/include
Modified Files:
Canvas.h Types.h
Log Message:
The implementation of Canvas are changed for better performance. setPenColor, setPenBackColor, setPenHatchStyle and all other setPen* functions are replaced with single function which changes all attributes of Canvas in single step.
Index: Canvas.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/include/Canvas.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Canvas.h 30 Jan 2003 20:43:25 -0000 1.5
--- Canvas.h 3 Feb 2003 16:53:41 -0000 1.6
***************
*** 10,13 ****
--- 10,15 ----
extern void osDoneCanvas (CanvasHandle);
+ extern void osChangeCanvasPen(int,int,unsigned int,unsigned int,int,int,int,int,unsigned char *,BOOL,int,BitmapHandle,FontHandle,CanvasHandle);
+
/* Operations to create, modify, and destroy polygon shapes.
*/
***************
*** 16,30 ****
extern void osDeletePolygon(PolygonHandle);
- extern void osSetPenSize (int,CanvasHandle);
- extern void osSetPenColor (unsigned int,CanvasHandle);
- extern void osSetBackColor (unsigned int,CanvasHandle);
- extern void osSetPenJoinStyle(int joinStyle, CanvasHandle canvas);
- extern void osSetPenCapStyle(int capStyle, CanvasHandle canvas);
- extern void osSetPenLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas);
- extern void osSetPenFunction(int function, CanvasHandle canvas);
- extern void osSetBkDrawMode(BOOL mode, CanvasHandle canvas);
- extern void osSetPenHatchStyle(int hatchStyle, BitmapHandle patBmp, CanvasHandle canvas);
- extern void osSetFont (FontHandle,CanvasHandle canvas);
-
extern void osRotateCanvas(double angle, CanvasHandle canvas);
extern void osScaleCanvas(double dScaleX, double dScaleY, CanvasHandle canvas);
--- 18,21 ----
***************
*** 32,68 ****
extern void osTranslateCanvas(double dDeltaX, double dDeltaY, CanvasHandle canvas);
- extern void osUndrawPoint (int x, int y, CanvasHandle canvas);
extern void osDrawPoint (int,int,CanvasHandle canvas);
extern void osDrawLine (int,int,int,int,CanvasHandle canvas);
- extern void osUndrawLine(int,int,int,int,CanvasHandle canvas);
extern void osDrawChar (int,int,char,CanvasHandle canvas);
- extern void osUndrawChar (int,int,char,CanvasHandle canvas);
extern void osDrawString (int,int,char*,CanvasHandle canvas);
- extern void osUndrawString (int,int,char*,CanvasHandle canvas);
extern void osDrawRect (int,int,int,int,CanvasHandle canvas);
- extern void osUndrawRect (int,int,int,int,CanvasHandle canvas);
extern void osFillRect (int,int,int,int,CanvasHandle canvas);
- extern void osEraseRect (int,int,int,int,CanvasHandle canvas);
extern void osDrawOval (int,int,int,int,CanvasHandle canvas);
- extern void osUndrawOval (int,int,int,int,CanvasHandle canvas);
extern void osFillOval (int,int,int,int,CanvasHandle canvas);
- extern void osEraseOval (int,int,int,int,CanvasHandle canvas);
extern void osDrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise, CanvasHandle canvas);
- extern void osUndrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise, CanvasHandle canvas);
extern void osFillCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise, CanvasHandle canvas);
- extern void osEraseCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise, CanvasHandle canvas);
extern void osDrawPolyline (PolygonHandle,CanvasHandle canvas);
- extern void osUndrawPolyline (PolygonHandle,CanvasHandle canvas);
extern void osDrawPolygon (PolygonHandle,CanvasHandle canvas);
- extern void osUndrawPolygon (PolygonHandle,CanvasHandle canvas);
extern void osFillPolygon (PolygonHandle,CanvasHandle canvas);
- extern void osErasePolygon (PolygonHandle,CanvasHandle canvas);
extern void osDrawBitmap (int,int,BitmapHandle,CanvasHandle canvas);
--- 23,46 ----
Index: Types.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/include/Types.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Types.h 27 Jan 2003 21:18:34 -0000 1.3
--- Types.h 3 Feb 2003 16:53:41 -0000 1.4
***************
*** 41,62 ****
HBITMAP hBufferBitmap;
BOOL bInvalidated;
! HPEN theNormalPen;
! HPEN theBackPen;
! HBRUSH theNormalBrush;
! HBRUSH theBackBrush;
HFONT theFont;
- int penSize;
- int joinStyle;
- int capStyle;
- int lineStyle;
DWORD stylesCount;
DWORD *stylesPtr;
- BitmapHandle patBmp;
- int hatchStyle;
- COLORREF penColor;
- COLORREF backColor;
-
- int lastActivity;
} *CanvasHandle;
--- 41,50 ----
HBITMAP hBufferBitmap;
BOOL bInvalidated;
! HPEN thePen;
! HBRUSH theBrush;
HFONT theFont;
DWORD stylesCount;
DWORD *stylesPtr;
} *CanvasHandle;
***************
*** 102,111 ****
{
GdkDrawable *drawable;
! GdkGC *theDrawGC, *theEraseGC, *theFillGC, *theUnfillGC, *theTextGC;
FontHandle theFont;
- gint penSize;
- int joinStyle;
- int capStyle;
- int lineStyle;
gint lineCustomCount;
gint8 *lineCustomDashes;
--- 90,95 ----
{
GdkDrawable *drawable;
! GdkGC *theDrawGC, *theFillGC, *theTextGC;
FontHandle theFont;
gint lineCustomCount;
gint8 *lineCustomDashes;
|
|
From: <kr_...@us...> - 2003-02-03 16:53:44
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv13436/port/src/cbits/GTK
Modified Files:
Canvas.c
Log Message:
The implementation of Canvas are changed for better performance. setPenColor, setPenBackColor, setPenHatchStyle and all other setPen* functions are replaced with single function which changes all attributes of Canvas in single step.
Index: Canvas.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Canvas.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Canvas.c 30 Jan 2003 20:43:25 -0000 1.7
--- Canvas.c 3 Feb 2003 16:53:40 -0000 1.8
***************
*** 22,28 ****
\*------------------------------------*/
- void ChangeLineAttributes(CanvasHandle canvas);
- void ChangePenDash(CanvasHandle canvas);
-
void osInitCanvas (int size, int function,
unsigned int pcolor,
--- 22,25 ----
***************
*** 43,49 ****
[...1009 lines suppressed...]
*** 906,923 ****
- void osUndrawPolygon(PolygonHandle arr, CanvasHandle canvas)
- {
- if (canvas->drawable) gdk_draw_polygon(canvas->drawable,canvas->theEraseGC,FALSE,arr->data,arr->count);
- } /* osUndrawPolygon */
-
void osFillPolygon (PolygonHandle arr, CanvasHandle canvas)
{
if (canvas->drawable) gdk_draw_polygon(canvas->drawable,canvas->theFillGC,TRUE,arr->data,arr->count);
} /* osFillPolygon */
-
- void osErasePolygon (PolygonHandle arr, CanvasHandle canvas)
- {
- if (canvas->drawable) gdk_draw_polygon(canvas->drawable,canvas->theUnfillGC,TRUE,arr->data,arr->count);
- } /* osErasePolygon */
CanvasHandle osGetTemporaryCanvas()
--- 641,648 ----
|
|
From: <kr_...@us...> - 2003-02-03 16:53:44
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv13436/port/src/Port
Modified Files:
Canvas.hs
Log Message:
The implementation of Canvas are changed for better performance. setPenColor, setPenBackColor, setPenHatchStyle and all other setPen* functions are replaced with single function which changes all attributes of Canvas in single step.
Index: Canvas.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Canvas.hs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Canvas.hs 30 Jan 2003 23:07:23 -0000 1.10
--- Canvas.hs 3 Feb 2003 16:53:40 -0000 1.11
***************
*** 15,18 ****
--- 15,19 ----
( -- * Canvas
initCanvas, doneCanvas
+ , changeCanvasPen
-- * Draw
***************
*** 43,60 ****
, Pen(..), defaultPen
- -- ** Attributes
- , setPenSize
- , setPenColor
- , setPenDrawMode
-
- -- ** Styles
- , setPenJoinStyle
- , setPenCapStyle
- , setPenLineStyle
- , setPenHatchStyle
- , setPenBackDrawMode
-
-- ** Font
- , setPenFont
, getPenFontMetrics
, getPenFontCharWidth
--- 44,48 ----
***************
*** 64,72 ****
, mmToVPixels, mmToHPixels
, getResolution, getScaleFactor
-
- -- * Deprecated ? (undraw\/erase)
- , setPenBackColor
- , undrawRect
- , eraseRect
) where
--- 52,55 ----
***************
*** 85,97 ****
-- | The pencil embodies common drawing attributes.
data Pen = Pen
! { penSize :: Int -- ^ Thickness of the pencil
! , penMode :: DrawMode
! , penColor :: Color
! , penFont :: Font
! , penJoinStyle :: JoinStyle
! , penCapStyle :: CapStyle
! , penLineStyle :: LineStyle
! , penHatchStyle :: HatchStyle
! , penBackColor :: Color
}
--- 68,81 ----
-- | The pencil embodies common drawing attributes.
data Pen = Pen
! { penSize :: !Int -- ^ Thickness of the pencil
! , penMode :: !DrawMode
! , penColor :: !Color
! , penBackColor :: !Color
! , penBkDrawMode :: !Bool
! , penFont :: !Font
! , penJoinStyle :: !JoinStyle
! , penCapStyle :: !CapStyle
! , penLineStyle :: !LineStyle
! , penHatchStyle :: !HatchStyle
}
***************
*** 101,105 ****
defaultPen :: Pen
defaultPen
! = Pen 1 DrawCopy black defaultFont JoinRound CapRound LineSolid HatchSolid white
--- 85,89 ----
defaultPen :: Pen
defaultPen
! = Pen 1 DrawCopy black white False defaultFont JoinRound CapRound LineSolid HatchSolid
***************
*** 107,111 ****
-- any of the drawing operations.
initCanvas :: Pen -> BufferMode -> CanvasHandle -> IO ()
! initCanvas pen buffermode canvas
= withCFont (penFont pen) $ \cfont ->
withCLineStyle (penLineStyle pen) $ \cline clinecount clinestyles ->
--- 91,95 ----
-- any of the drawing operations.
initCanvas :: Pen -> BufferMode -> CanvasHandle -> IO ()
! initCanvas pen buffermode canvas
= withCFont (penFont pen) $ \cfont ->
withCLineStyle (penLineStyle pen) $ \cline clinecount clinestyles ->
***************
*** 118,122 ****
(toCCapStyle (penCapStyle pen))
cline clinecount clinestyles
! (toCBool False) -- bk draw mode
chatch chatchbmp
cfont
--- 102,106 ----
(toCCapStyle (penCapStyle pen))
cline clinecount clinestyles
! (toCBool (penBkDrawMode pen))
chatch chatchbmp
cfont
***************
*** 140,148 ****
Pen
-----------------------------------------------------------------------------------------}
! -- | Set the pen font.
! setPenFont :: Font -> CanvasHandle -> IO ()
! setPenFont font canvas
! = withCFont font $ \fhandle -> osSetFont fhandle canvas
! foreign import ccall osSetFont :: FontHandle -> CanvasHandle -> IO ()
-- | The metrics for the current pen font. (See also 'getFontMetrics').
--- 124,156 ----
Pen
-----------------------------------------------------------------------------------------}
!
! changeCanvasPen :: Pen -> CanvasHandle -> IO ()
! changeCanvasPen pen canvas =
! withCFont (penFont pen) $ \cfont ->
! withCLineStyle (penLineStyle pen) $ \cline clinecount clinestyles ->
! withCHatchStyle (penHatchStyle pen) $ \chatch chatchbmp ->
! osChangeCanvasPen (toCInt (penSize pen))
! (toCDrawMode (penMode pen))
! (toCColor (penColor pen))
! (toCColor (penBackColor pen))
! (toCJoinStyle (penJoinStyle pen))
! (toCCapStyle (penCapStyle pen))
! cline clinecount clinestyles
! (toCBool (penBkDrawMode pen))
! chatch chatchbmp
! cfont
! canvas
! foreign import ccall osChangeCanvasPen :: CInt -> CInt -> CWord -> CWord
! -> CInt -> CInt
! -> CInt -> CInt -> Ptr CUChar
! -> CBool
! -> CInt -> BitmapHandle
! -> FontHandle
! -> CanvasHandle -> IO ()
!
!
! {-----------------------------------------------------------------------------------------
! Font & Text metrics
! -----------------------------------------------------------------------------------------}
-- | The metrics for the current pen font. (See also 'getFontMetrics').
***************
*** 168,221 ****
foreign import ccall osGetStringWidth :: CString -> CanvasHandle -> IO CInt
- -- | Set the size of the pen.
- setPenSize :: Int -> CanvasHandle -> IO ()
- setPenSize sz canvas
- = osSetPenSize (toCInt sz) canvas
- foreign import ccall "osSetPenSize" osSetPenSize :: CInt -> CanvasHandle -> IO ()
-
- setPenColor :: Color -> CanvasHandle -> IO ()
- setPenColor c canvas
- = osSetPenColor (toCColor c) canvas
- foreign import ccall "osSetPenColor" osSetPenColor :: CWord -> CanvasHandle -> IO ()
-
- setPenBackColor :: Color -> CanvasHandle -> IO ()
- setPenBackColor c canvas
- = osSetBackColor (toCColor c) canvas
- foreign import ccall "osSetBackColor" osSetBackColor :: CWord -> CanvasHandle -> IO ()
-
- setPenDrawMode :: DrawMode -> CanvasHandle -> IO ()
- setPenDrawMode drawmode canvas
- = osSetDrawMode (toCDrawMode drawmode) canvas
- foreign import ccall "osSetPenFunction" osSetDrawMode :: CInt -> CanvasHandle -> IO ()
-
- -- | When back draw mode is set to @True@ and the hatch style is not solid then
- -- off segments are drawn with background color. When the mode is @False@ then
- -- off segments are trasparent.
- setPenBackDrawMode :: Bool -> CanvasHandle -> IO ()
- setPenBackDrawMode mode canvas
- = osSetBkDrawMode (toCBool mode) canvas
- foreign import ccall osSetBkDrawMode :: CBool -> CanvasHandle -> IO ()
-
- setPenJoinStyle :: JoinStyle -> CanvasHandle -> IO ()
- setPenJoinStyle join canvas
- = osSetPenJoinStyle (toCJoinStyle join) canvas
- foreign import ccall osSetPenJoinStyle :: CInt -> CanvasHandle -> IO ()
-
- setPenCapStyle :: CapStyle -> CanvasHandle -> IO ()
- setPenCapStyle cap canvas
- = osSetPenCapStyle (toCCapStyle cap) canvas
- foreign import ccall osSetPenCapStyle :: CInt -> CanvasHandle -> IO ()
-
- setPenLineStyle :: LineStyle -> CanvasHandle -> IO ()
- setPenLineStyle line canvas
- = withCLineStyle line $ \cstyle ccount cstyles ->
- osSetPenLineStyle cstyle ccount cstyles canvas
- foreign import ccall osSetPenLineStyle :: CInt -> CInt -> Ptr CUChar -> CanvasHandle -> IO ()
-
- setPenHatchStyle :: HatchStyle -> CanvasHandle -> IO ()
- setPenHatchStyle hatch canvas
- = withCHatchStyle hatch $ \cstyle cbitmap ->
- osSetPenHatchStyle cstyle cbitmap canvas
- foreign import ccall osSetPenHatchStyle :: CInt -> BitmapHandle -> CanvasHandle -> IO ()
{-----------------------------------------------------------------------------------------
--- 176,179 ----
***************
*** 312,326 ****
= withCRect rect $ \x0 y0 x1 y1 -> osFillRect x0 y0 x1 y1 canvas
foreign import ccall osFillRect :: CInt -> CInt -> CInt -> CInt -> CanvasHandle -> IO ()
-
- undrawRect :: Rect -> CanvasHandle -> IO ()
- undrawRect rect canvas
- = withCRect rect $ \x0 y0 x1 y1 -> osUndrawRect x0 y0 x1 y1 canvas
- foreign import ccall osUndrawRect :: CInt -> CInt -> CInt -> CInt -> CanvasHandle -> IO ()
-
- eraseRect :: Rect -> CanvasHandle -> IO ()
- eraseRect rect canvas
- = withCRect rect $ \x0 y0 x1 y1 -> osEraseRect x0 y0 x1 y1 canvas
- foreign import ccall osEraseRect :: CInt -> CInt -> CInt -> CInt -> CanvasHandle -> IO ()
-
{-----------------------------------------------------------------------------------------
--- 270,273 ----
|
|
From: <kr_...@us...> - 2003-02-01 12:52:38
|
Update of /cvsroot/htoolkit/HToolkit/Examples/ByeDemo In directory sc8-pr-cvs1:/tmp/cvs-serv15456/ByeDemo Added Files: Main.hs Log Message: Add ByeDemo --- NEW FILE: Main.hs --- module Main where import Graphics.UI.HGUI import Data.IORef bye_form closef ~(frm :+: stRef :+: txt :+: btn) = form [title "Buy!", onclose guiMainExit] $ newIORef True </> (text [title "Hello World"]) <|> (fillXY . expandXY 1 1) (button [title "Bye", onclick bye]) where bye = do st <- readIORef stRef if st then do btn # setText "Goodbye" writeIORef stRef False else closef >> guiMainExit main = showForm bye_form >> guiMain |
|
From: <kr_...@us...> - 2003-02-01 12:48:40
|
Update of /cvsroot/htoolkit/HToolkit/Examples/ByeDemo In directory sc8-pr-cvs1:/tmp/cvs-serv14004/ByeDemo Log Message: Directory /cvsroot/htoolkit/HToolkit/Examples/ByeDemo added to the repository |
|
From: <kr_...@us...> - 2003-02-01 08:58:59
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv9137/port/src/cbits/Win32
Modified Files:
Bitmap.c
Log Message:
Bug fix. The writeBitmap and drawBitmap was buggy when the bitmap is resized
Index: Bitmap.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Bitmap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Bitmap.c 31 Jan 2003 23:25:37 -0000 1.2
--- Bitmap.c 1 Feb 2003 08:58:56 -0000 1.3
***************
*** 305,311 ****
canvas->hDC = CreateCompatibleDC(hScreenDC);
! DeleteDC(hScreenDC);
! SelectObject(canvas->hDC, bitmap->hBitmap);
return canvas;
--- 305,331 ----
canvas->hDC = CreateCompatibleDC(hScreenDC);
! if (bitmap->destsize.cx != bitmap->sourcesize.cx || bitmap->destsize.cy != bitmap->sourcesize.cy)
! {
! HDC hSourceDC;
! HBITMAP hBitmap;
! hBitmap = CreateCompatibleBitmap(hScreenDC, bitmap->destsize.cx, bitmap->destsize.cy);
! SelectObject(canvas->hDC, hBitmap);
!
! hSourceDC = CreateCompatibleDC(hScreenDC);
! SelectObject(hSourceDC, bitmap->hBitmap);
!
! StretchBlt(canvas->hDC, 0, 0, bitmap->destsize.cx, bitmap->destsize.cy, hSourceDC, 0, 0, bitmap->sourcesize.cx, bitmap->sourcesize.cy, SRCCOPY);
!
! DeleteDC(hSourceDC);
!
! DeleteObject(bitmap->hBitmap);
! bitmap->hBitmap = hBitmap;
! bitmap->sourcesize = bitmap->destsize;
! }
! else
! SelectObject(canvas->hDC, bitmap->hBitmap);
!
! DeleteDC(hScreenDC);
return canvas;
***************
*** 353,356 ****
--- 373,378 ----
{
HDC hScreenDC;
+ HBITMAP hBitmap;
+ BOOL bFlag;
hScreenDC = CreateDC("DISPLAY",NULL,NULL,NULL);
***************
*** 358,361 ****
--- 380,407 ----
return 1;
+ if (bitmap->destsize.cx != bitmap->sourcesize.cx || bitmap->destsize.cy != bitmap->sourcesize.cy)
+ {
+ HDC hSourceDC, hDestDC;
+
+ hDestDC = CreateCompatibleDC(hScreenDC);
+ hBitmap = CreateCompatibleBitmap(hScreenDC, bitmap->destsize.cx, bitmap->destsize.cy);
+ SelectObject(hDestDC, hBitmap);
+
+ hSourceDC = CreateCompatibleDC(hScreenDC);
+ SelectObject(hSourceDC, bitmap->hBitmap);
+
+ StretchBlt(hDestDC, 0, 0, bitmap->destsize.cx, bitmap->destsize.cy, hSourceDC, 0, 0, bitmap->sourcesize.cx, bitmap->sourcesize.cy, SRCCOPY);
+
+ DeleteDC(hDestDC);
+ DeleteDC(hSourceDC);
+
+ bFlag = TRUE;
+ }
+ else
+ {
+ hBitmap = bitmap->hBitmap;
+ bFlag = FALSE;
+ }
+
if (initGdiPlus())
{
***************
*** 376,379 ****
--- 422,426 ----
rfree(lpwBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 1;
}
***************
*** 384,387 ****
--- 431,435 ----
rfree(lpwBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 2;
}
***************
*** 391,394 ****
--- 439,443 ----
rfree(lpwBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 1;
}
***************
*** 396,403 ****
gpBitmap = NULL;
! if (GdipCreateBitmapFromHBITMAP(bitmap->hBitmap, hPal, &gpBitmap) != 0 || !gpBitmap)
{
rfree(lpwBuffer);
DeleteDC(hScreenDC);
return 1;
}
--- 445,453 ----
gpBitmap = NULL;
! if (GdipCreateBitmapFromHBITMAP(hBitmap, hPal, &gpBitmap) != 0 || !gpBitmap)
{
rfree(lpwBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 1;
}
***************
*** 408,411 ****
--- 458,462 ----
GdipDisposeImage(gpBitmap);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 3;
}
***************
*** 428,431 ****
--- 479,483 ----
{
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 2;
}
***************
*** 436,442 ****
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biBitCount = 0; // dont get the color table
! if (!GetDIBits(hScreenDC, bitmap->hBitmap, 0, 0, NULL, &bmi, DIB_RGB_COLORS))
{
DeleteDC(hScreenDC);
return 1;
}
--- 488,495 ----
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biBitCount = 0; // dont get the color table
! if (!GetDIBits(hScreenDC, hBitmap, 0, 0, NULL, &bmi, DIB_RGB_COLORS))
{
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 1;
}
***************
*** 476,483 ****
// Assume that the hDC is the DC where the bitmap would have been selected
// if indeed it has been selected
! if (!GetDIBits(hScreenDC, bitmap->hBitmap, 0, pBMI->bmiHeader.biHeight, pBits, pBMI, DIB_RGB_COLORS))
{
rfree(pBuffer);
DeleteDC(hScreenDC);
return 1;
}
--- 529,537 ----
// Assume that the hDC is the DC where the bitmap would have been selected
// if indeed it has been selected
! if (!GetDIBits(hScreenDC, hBitmap, 0, pBMI->bmiHeader.biHeight, pBits, pBMI, DIB_RGB_COLORS))
{
rfree(pBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 1;
}
***************
*** 487,490 ****
--- 541,545 ----
rfree(pBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 3;
}
***************
*** 496,499 ****
--- 551,555 ----
rfree(pBuffer);
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 3;
}
***************
*** 504,507 ****
--- 560,564 ----
DeleteDC(hScreenDC);
+ if (bFlag) DeleteObject(hBitmap);
return 0;
|
|
From: <dl...@us...> - 2003-01-31 23:27:27
|
Update of /cvsroot/htoolkit/port/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv12489/src/examples
Modified Files:
ByeDemo.hs
Log Message:
more comments to the demo
Index: ByeDemo.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/examples/ByeDemo.hs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ByeDemo.hs 31 Jan 2003 21:21:29 -0000 1.1
--- ByeDemo.hs 31 Jan 2003 23:27:24 -0000 1.2
***************
*** 21,41 ****
registerWindowPaint w (\can upd -> fillRect upd can) -- fill the background with some color
setWindowDomainSize w (Size 0 0) -- no scroll bars needed
! setWindowViewSize w (Size 80 40) -- guess some size as Port has no layout manager
! setWindowTitle w "Bye!"
l <- createLabel w
setLabelText l "Hello World!"
! lsize <- getLabelRequestSize l -- get minimal size
moveResizeControl l (rectAt (Point 0 0) lsize) -- position in upperleft corner
b <- createButton w
setButtonText b "Bye"
! bsize <- getButtonRequestSize b
moveResizeControl b (rectAt (Point 0 (sh lsize)) bsize) -- position under the label
registerButtonClick b (bye w l b) -- register event handler
! showWindow w
where
bye w l b
= do setLabelText l "Goodbye"
! registerButtonClick b (closeWindow w)
--- 21,42 ----
registerWindowPaint w (\can upd -> fillRect upd can) -- fill the background with some color
setWindowDomainSize w (Size 0 0) -- no scroll bars needed
! setWindowViewSize w (Size 80 40) -- guess some size as Port has no layout manager
! setWindowTitle w "Bye!" -- set the title bar text
l <- createLabel w
setLabelText l "Hello World!"
! lsize <- getLabelRequestSize l -- get the minimal size of the label
moveResizeControl l (rectAt (Point 0 0) lsize) -- position in upperleft corner
b <- createButton w
setButtonText b "Bye"
! bsize <- getButtonRequestSize b -- get the minimal size of the button
moveResizeControl b (rectAt (Point 0 (sh lsize)) bsize) -- position under the label
registerButtonClick b (bye w l b) -- register event handler
! showWindow w -- show it all
where
+ -- called on the first click with the window, label, and button as arguments.
bye w l b
= do setLabelText l "Goodbye"
! registerButtonClick b (closeWindow w) -- overwrite the old event handler
|
|
From: <dl...@us...> - 2003-01-31 23:27:12
|
Update of /cvsroot/htoolkit/gio/src/examples/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv12374/src/examples/simple
Modified Files:
ByeDemo.hs
Log Message:
more comments for the demo
Index: ByeDemo.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/ByeDemo.hs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ByeDemo.hs 31 Jan 2003 20:54:57 -0000 1.1
--- ByeDemo.hs 31 Jan 2003 23:27:09 -0000 1.2
***************
*** 11,14 ****
--- 11,15 ----
first time, it calls "bye". This function changes the text of the label
and installs another event handler on the button that closes the main window.
+ (by default, GIO exits the gui when all windows are closed).
--------------------------------------------------------------------------------}
module Main where
***************
*** 25,28 ****
--- 26,30 ----
set b [on command =: bye w l b]
where
+ -- called on the first click, with the window, label, and button as arguments.
bye w l b
= do set l [text =: "Goodbye"]
|
|
From: <kr_...@us...> - 2003-01-31 23:25:41
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv11500/port/src/include Modified Files: Bitmap.h Log Message: Change the definition of osGetBitmapSize. The new definition allows using of withCSizeResult function at Haskell level Index: Bitmap.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Bitmap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Bitmap.h 22 Jan 2003 01:21:11 -0000 1.2 --- Bitmap.h 31 Jan 2003 23:25:38 -0000 1.3 *************** *** 9,13 **** extern int osWriteBitmap(BitmapHandle bitmap, char *format, char *fname); extern void osResizeBitmap (BitmapHandle bitmap, int width, int height); ! extern void osGetBitmapSize (BitmapHandle bitmap, int *width, int *height); extern CanvasHandle osGetBitmapCanvas(BitmapHandle bitmap); extern void osReleaseBitmapCanvas(CanvasHandle canvas); --- 9,13 ---- extern int osWriteBitmap(BitmapHandle bitmap, char *format, char *fname); extern void osResizeBitmap (BitmapHandle bitmap, int width, int height); ! extern void osGetBitmapSize (BitmapHandle bitmap, int *size); extern CanvasHandle osGetBitmapCanvas(BitmapHandle bitmap); extern void osReleaseBitmapCanvas(CanvasHandle canvas); |
|
From: <kr_...@us...> - 2003-01-31 23:25:40
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv11500/port/src/cbits/GTK
Modified Files:
Bitmap.c
Log Message:
Change the definition of osGetBitmapSize. The new definition allows using of withCSizeResult function at Haskell level
Index: Bitmap.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Bitmap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Bitmap.c 23 Jan 2003 20:19:32 -0000 1.2
--- Bitmap.c 31 Jan 2003 23:25:37 -0000 1.3
***************
*** 82,89 ****
}
! void osGetBitmapSize (BitmapHandle bitmap, int *width, int *height)
{
! *width = bitmap->width;
! *height = bitmap->height;
}
--- 82,89 ----
}
! void osGetBitmapSize (BitmapHandle bitmap, int *size)
{
! size[0] = bitmap->width;
! size[1] = bitmap->height;
}
|
|
From: <kr_...@us...> - 2003-01-31 23:25:40
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv11500/port/src/cbits/Win32
Modified Files:
Bitmap.c
Log Message:
Change the definition of osGetBitmapSize. The new definition allows using of withCSizeResult function at Haskell level
Index: Bitmap.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Bitmap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Bitmap.c 21 Jan 2003 22:01:10 -0000 1.1
--- Bitmap.c 31 Jan 2003 23:25:37 -0000 1.2
***************
*** 273,280 ****
}
! void osGetBitmapSize (BitmapHandle bitmap, int *width, int *height)
{
! *width = bitmap->destsize.cx;
! *height = bitmap->destsize.cy;
}
--- 273,280 ----
}
! void osGetBitmapSize (BitmapHandle bitmap, int *size)
{
! size[0] = bitmap->destsize.cx;
! size[1] = bitmap->destsize.cy;
}
|
|
From: <kr_...@us...> - 2003-01-31 23:25:40
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv11500/port/src/Port
Modified Files:
Bitmap.hs
Log Message:
Change the definition of osGetBitmapSize. The new definition allows using of withCSizeResult function at Haskell level
Index: Bitmap.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Bitmap.hs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Bitmap.hs 21 Jan 2003 22:01:08 -0000 1.2
--- Bitmap.hs 31 Jan 2003 23:25:37 -0000 1.3
***************
*** 96,106 ****
getBitmapSize bitmap
= withCBitmap bitmap $ \bh ->
! alloca $ \pw ->
! alloca $ \ph ->
! do osGetBitmapSize bh pw ph
! w <- peek pw
! h <- peek ph
! return (fromCSize w h)
! foreign import ccall osGetBitmapSize :: BitmapHandle -> Ptr CInt -> Ptr CInt -> IO ()
-- | Stretch a bitmap to a different size.
--- 96,101 ----
getBitmapSize bitmap
= withCBitmap bitmap $ \bh ->
! withCSizeResult (osGetBitmapSize bh)
! foreign import ccall osGetBitmapSize :: BitmapHandle -> Ptr CInt -> IO ()
-- | Stretch a bitmap to a different size.
|
|
From: <kr_...@us...> - 2003-01-31 22:50:09
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv31355/port/src/cbits/Win32
Modified Files:
Window.c
Log Message:
Bug fix. The scrollbars should be fixed when view size and view domain are equals.
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Window.c 31 Jan 2003 15:31:50 -0000 1.4
--- Window.c 31 Jan 2003 22:50:04 -0000 1.5
***************
*** 849,853 ****
(wrect.right-wrect.left) + (w - (crect.right-crect.left)),
(wrect.bottom-wrect.top) + (h - (crect.bottom - crect.top)),
! SWP_NOZORDER);
}
--- 849,853 ----
(wrect.right-wrect.left) + (w - (crect.right-crect.left)),
(wrect.bottom-wrect.top) + (h - (crect.bottom - crect.top)),
! SWP_NOZORDER);
}
***************
*** 874,883 ****
si.nMin = 0;
! si.nMax = pData->DomainSize.cx;
si.nPage = nWidth;
SetScrollInfo(window, SB_HORZ, &si, TRUE);
si.nMin = 0;
! si.nMax = pData->DomainSize.cy;
si.nPage = nHeight;
SetScrollInfo(window, SB_VERT, &si, TRUE);
--- 874,883 ----
si.nMin = 0;
! si.nMax = pData->DomainSize.cx-1;
si.nPage = nWidth;
SetScrollInfo(window, SB_HORZ, &si, TRUE);
si.nMin = 0;
! si.nMax = pData->DomainSize.cy-1;
si.nPage = nHeight;
SetScrollInfo(window, SB_VERT, &si, TRUE);
|
|
From: <dl...@us...> - 2003-01-31 21:21:34
|
Update of /cvsroot/htoolkit/port/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv30172/src/examples
Added Files:
ByeDemo.hs
Log Message:
added the goodbye demo for Port
--- NEW FILE: ByeDemo.hs ---
{--------------------------------------------------------------------------------
This program implements the "goodbye" demo as posted by John Meacham on
the Haskell GUI mailing list. The program is specified as:
I propose a simple program which pops up a window saying 'Hello World'
with a button saying 'Bye' which you click and it changes the message
to 'Goodbye'. if you click the button again the program exits.
--------------------------------------------------------------------------------}
module Main where
import Graphics.UI.Port
main = do demo -- setup gui
start -- start event loop
demo :: IO ()
demo
= do w <- createWindow
registerWindow w -- register for proper shutdown
registerWindowDismiss w (closeWindow w) -- close when the user dismisses the window
registerWindowPaint w (\can upd -> fillRect upd can) -- fill the background with some color
setWindowDomainSize w (Size 0 0) -- no scroll bars needed
setWindowViewSize w (Size 80 40) -- guess some size as Port has no layout manager
setWindowTitle w "Bye!"
l <- createLabel w
setLabelText l "Hello World!"
lsize <- getLabelRequestSize l -- get minimal size
moveResizeControl l (rectAt (Point 0 0) lsize) -- position in upperleft corner
b <- createButton w
setButtonText b "Bye"
bsize <- getButtonRequestSize b
moveResizeControl b (rectAt (Point 0 (sh lsize)) bsize) -- position under the label
registerButtonClick b (bye w l b) -- register event handler
showWindow w
where
bye w l b
= do setLabelText l "Goodbye"
registerButtonClick b (closeWindow w)
|
|
From: <dl...@us...> - 2003-01-31 21:21:02
|
Update of /cvsroot/htoolkit/port/src/examples In directory sc8-pr-cvs1:/tmp/cvs-serv30050/src/examples Log Message: Directory /cvsroot/htoolkit/port/src/examples added to the repository |
|
From: <dl...@us...> - 2003-01-31 21:06:42
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv23717/src/Graphics/UI/GIO Modified Files: Events.hs Log Message: changed because of Port rename of windowClose to windowDismiss Index: Events.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Events.hs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Events.hs 31 Jan 2003 01:01:44 -0000 1.3 --- Events.hs 31 Jan 2003 21:06:40 -0000 1.4 *************** *** 346,350 **** -- Forms newDismissEvent, newActivateEvent, newDeactivateEvent :: StdWindowEvent w (IO ()) ! newDismissEvent = stdWindowEvent0 Lib.registerWindowClose newActivateEvent = stdWindowEvent0 Lib.registerWindowActivate newDeactivateEvent= stdWindowEvent0 Lib.registerWindowDeactivate --- 346,350 ---- -- Forms newDismissEvent, newActivateEvent, newDeactivateEvent :: StdWindowEvent w (IO ()) ! newDismissEvent = stdWindowEvent0 Lib.registerWindowDismiss newActivateEvent = stdWindowEvent0 Lib.registerWindowActivate newDeactivateEvent= stdWindowEvent0 Lib.registerWindowDeactivate |
|
From: <dl...@us...> - 2003-01-31 21:06:16
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv23303/src/Port
Modified Files:
Handlers.hs
Log Message:
changed name of xxxWindowClose to xxxWindowDismiss as that
is what is meant. Actually, xxxWindowDestroy should probably
be called xxxWindowClose but let's leave that for now.
Index: Handlers.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Handlers.hs 30 Jan 2003 23:09:46 -0000 1.6
--- Handlers.hs 31 Jan 2003 21:06:13 -0000 1.7
***************
*** 44,48 ****
-- ** Register events
,registerWindowReLayout
! ,registerWindowClose
,registerWindowDestroy
,registerWindowPaint
--- 44,48 ----
-- ** Register events
,registerWindowReLayout
! ,registerWindowDismiss
,registerWindowDestroy
,registerWindowPaint
***************
*** 59,63 ****
-- ** Unregister events
,unregisterWindowReLayout
! ,unregisterWindowClose
,unregisterWindowDestroy
,unregisterWindowPaint
--- 59,63 ----
-- ** Unregister events
,unregisterWindowReLayout
! ,unregisterWindowDismiss
,unregisterWindowDestroy
,unregisterWindowPaint
***************
*** 160,164 ****
= do clear handlersWindowDestroy
clear handlersWindowReLayout
! clear handlersWindowClose
clear handlersWindowPaint
clear handlersWindowResize
--- 160,164 ----
= do clear handlersWindowDestroy
clear handlersWindowReLayout
! clear handlersWindowDismiss
clear handlersWindowPaint
clear handlersWindowResize
***************
*** 186,190 ****
unregisterAllWindowHandlers hwnd
= do unregisterWindowReLayout hwnd
! unregisterWindowClose hwnd
unregisterWindowDestroy hwnd
unregisterWindowPaint hwnd
--- 186,190 ----
unregisterAllWindowHandlers hwnd
= do unregisterWindowReLayout hwnd
! unregisterWindowDismiss hwnd
unregisterWindowDestroy hwnd
unregisterWindowPaint hwnd
***************
*** 321,340 ****
= invokeHandler hwnd handlersWindowReLayout id
! {-# NOINLINE handlersWindowClose #-}
! handlersWindowClose :: MVar (PtrMap WindowHandle (IO ()))
! handlersWindowClose
= unsafePerformIO (newMVar empty)
! registerWindowClose :: WindowHandle -> IO () -> IO ()
! registerWindowClose hwnd handler
! = register hwnd handler handlersWindowClose
! unregisterWindowClose :: WindowHandle -> IO ()
! unregisterWindowClose hwnd
! = unregister hwnd handlersWindowClose
handleWindowClose :: WindowHandle -> IO ()
handleWindowClose hwnd
! = invokeHandler hwnd handlersWindowClose id
{-# NOINLINE handlersPopUpClick #-}
--- 321,340 ----
= invokeHandler hwnd handlersWindowReLayout id
! {-# NOINLINE handlersWindowDismiss #-}
! handlersWindowDismiss :: MVar (PtrMap WindowHandle (IO ()))
! handlersWindowDismiss
= unsafePerformIO (newMVar empty)
! registerWindowDismiss :: WindowHandle -> IO () -> IO ()
! registerWindowDismiss hwnd handler
! = register hwnd handler handlersWindowDismiss
! unregisterWindowDismiss :: WindowHandle -> IO ()
! unregisterWindowDismiss hwnd
! = unregister hwnd handlersWindowDismiss
handleWindowClose :: WindowHandle -> IO ()
handleWindowClose hwnd
! = invokeHandler hwnd handlersWindowDismiss id
{-# NOINLINE handlersPopUpClick #-}
|