|
From: <cre...@us...> - 2007-02-19 01:25:39
|
Revision: 1615
http://svn.sourceforge.net/frontierkernel/?rev=1615&view=rev
Author: creecode
Date: 2007-02-18 17:25:35 -0800 (Sun, 18 Feb 2007)
Log Message:
-----------
in function alertdialog, removed non-carbon code
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/dialogs.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/dialogs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/dialogs.c 2007-02-19 01:20:14 UTC (rev 1614)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/dialogs.c 2007-02-19 01:25:35 UTC (rev 1615)
@@ -1578,38 +1578,68 @@
disposemodaldialog (pdialog);
return (itemnumber == askokitem);
+
} /*askdialog*/
-boolean twowaydialog (bigstring bsprompt, bigstring okbutton, bigstring cancelbutton) {
+boolean twowaydialog ( bigstring prompt, bigstring okbutton, bigstring cancelbutton ) {
+
+ #ifdef MACVERSION
- register DialogPtr pdialog;
- register short item;
+ register DialogPtr pdialog;
+ register short item;
+
+ if ((pdialog = newmodaldialog (twowaydialogid, twowayokitem)) == nil)
+ return (false);
+
+ setdialogtext (pdialog, twowaymsgitem, prompt);
+
+ dialogsetbuttonstring (pdialog, twowayokitem, okbutton);
+
+ dialogsetbuttonstring (pdialog, twowaycancelitem, cancelbutton);
+
+ WindowRef pWind = GetDialogWindow(pdialog);
+
+ ShowWindow(pWind);
+
+ item = runmodaldialog ();
+
+ disposemodaldialog (pdialog);
+
+ return (item == twowayokitem);
+
+ #endif // MACVERSION
- if ((pdialog = newmodaldialog (twowaydialogid, twowayokitem)) == nil)
- return (false);
+ #ifdef WIN95VERSION
- setdialogtext (pdialog, twowaymsgitem, bsprompt);
+ int nResult;
+ char s[256];
+
+ copyptocstring (prompt, s);
+ setbuttonstring (okbutton, gMsgRetryButton);
+ setbuttonstring (cancelbutton, gMsgCancelButton);
+
+ setmessageboxbuttonsize (2);
+
+ releasethreadglobals ();
+
+ // Set a task specific CBT hook before calling MessageBox. The CBT hook will
+ // be called when the message box is created and will give us access to
+ // the window handle of the MessageBox. The message box
+ // can then be subclassed in the CBT hook to change the color of the text and
+ // background. Remove the hook after the MessageBox is destroyed.
+
+ g_hhookCBT = SetWindowsHookEx(WH_CBT, CBTProc, shellinstance, 0);
+ nResult = MessageBox(hwndMDIClient, s, frontierstring, MB_RETRYCANCEL | MB_APPLMODAL);
+ UnhookWindowsHookEx(g_hhookCBT);
+
+ grabthreadglobals ();
+
+ return (nResult == IDRETRY);
+
+ #endif // WIN95VERSION
- dialogsetbuttonstring (pdialog, twowayokitem, okbutton);
-
- dialogsetbuttonstring (pdialog, twowaycancelitem, cancelbutton);
-
- #if TARGET_API_MAC_CARBON == 1
- {
- WindowRef pWind = GetDialogWindow(pdialog);
- ShowWindow(pWind);
- }
- #else
- ShowWindow (pdialog);
- #endif
-
- item = runmodaldialog ();
-
- disposemodaldialog (pdialog);
-
- return (item == twowayokitem);
- } /*twowaydialog*/
+ } // twowaydialog
short threewaydialog (bigstring bsprompt, bigstring yesbutton, bigstring nobutton, bigstring cancelbutton) {
@@ -1821,10 +1851,12 @@
boolean alertdialog (bigstring bsprompt) {
- /*
- put up the standard "alert" dialog, with the provided prompt and return
- true if the user clicked on ok. false if cancel was clicked.
- */
+ //
+ // put up the standard "alert" dialog, with the provided prompt and return
+ // true if the user clicked on ok. false if cancel was clicked.
+ //
+ // 2007-02-18 creedon: removed non-carbon code
+ //
register DialogPtr pdialog;
register short itemnumber;
@@ -1836,19 +1868,15 @@
setdialogtext (pdialog, alertmsgitem, bsprompt);
- #if TARGET_API_MAC_CARBON == 1
- {
WindowRef pWind = GetDialogWindow(pdialog);
ShowWindow(pWind);
- }
- #else
- ShowWindow (pdialog);
- #endif
+
itemnumber = runmodaldialog ();
disposemodaldialog (pdialog);
return (itemnumber == alertokitem);
+
} /*alertdialog*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|