Changeset 85
- Timestamp:
- 21/05/07 17:28:04 (6 years ago)
- Location:
- trunk/OpenYahtzee
- Files:
-
- 1 added
- 7 edited
-
openyahtzee.kdevelop.pcs (modified) (previous)
-
openyahtzee.kdevses (modified) (1 diff)
-
src/MainFrame.cpp (modified) (4 diffs)
-
src/MainFrame.h (modified) (1 diff)
-
src/Makefile.am (modified) (1 diff)
-
src/Makefile.in (modified) (3 diffs)
-
src/UtilityFunctions.cpp (added)
-
src/UtilityFunctions.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/OpenYahtzee/openyahtzee.kdevses
r84 r85 2 2 <!DOCTYPE KDevPrjSession> 3 3 <KDevPrjSession> 4 <DocsAndViews NumberOfDocuments=" 10" >4 <DocsAndViews NumberOfDocuments="8" > 5 5 <Doc0 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/About.cpp" > 6 <View0 line="106" Type="Source" /> 7 </Doc0> 8 <Doc1 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/openyahtzee.cpp" > 6 9 <View0 line="0" Type="Source" /> 7 </Doc0>8 <Doc1 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/DBwrapper.cpp" >9 <View0 Type="Source" />10 10 </Doc1> 11 <Doc2 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/ DBwrapper.h" >12 <View0 Type="Source" />11 <Doc2 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/MainFrame.cpp" > 12 <View0 line="505" Type="Source" /> 13 13 </Doc2> 14 <Doc3 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/ HighScoreDialog.cpp" >15 <View0 Type="Source" />14 <Doc3 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/MainFrame.h" > 15 <View0 line="31" Type="Source" /> 16 16 </Doc3> 17 <Doc4 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/ openyahtzee.cpp" >18 <View0 line=" 0" Type="Source" />17 <Doc4 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/About.h" > 18 <View0 line="24" Type="Source" /> 19 19 </Doc4> 20 <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/ MainFrame.cpp" >21 <View0 line="3 6" Type="Source" />20 <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/UtilityFunctions.h" > 21 <View0 line="30" Type="Source" /> 22 22 </Doc5> 23 <Doc6 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/ MainFrame.h" >24 <View0 line="2 0" Type="Source" />23 <Doc6 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/UtilityFunctions.cpp" > 24 <View0 line="23" Type="Source" /> 25 25 </Doc6> 26 <Doc7 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/ HighScoreDialog.h" >27 <View0 line=" 33" Type="Source" />26 <Doc7 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/wxDynamicBitmap.cpp" > 27 <View0 line="84" Type="Source" /> 28 28 </Doc7> 29 <Doc8 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/About.h" >30 <View0 line="66" Type="Source" />31 </Doc8>32 <Doc9 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/UtilityFunctions.h" >33 <View0 line="80" Type="Source" />34 </Doc9>35 29 </DocsAndViews> 36 30 <pluginList> -
trunk/OpenYahtzee/src/MainFrame.cpp
r84 r85 56 56 #define DEF_HIGHSCORESIZE 20 57 57 #define OY_VERSION "1.7.0" 58 59 DEFINE_EVENT_TYPE(wxEVT_ENABLE_ROLL) 60 58 61 59 62 MainFrame::MainFrame(const wxString& title, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE) … … 231 234 232 235 Connect(ID_ROLL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnRollButton)); 236 Connect(ID_ROLL, wxEVT_ENABLE_ROLL, wxCommandEventHandler (MainFrame::OnRollButton)); 233 237 234 238 //BEGIN connecting the scoreboard buttons to the events … … 444 448 void MainFrame::OnRollButton (wxCommandEvent& event) 445 449 { 450 if (event.GetEventType() == wxEVT_ENABLE_ROLL) { 451 //here we reconnect the event handler. We should recieve this event only after 452 //the dice stopped rolling and all other click events where skipped. 453 Connect(ID_ROLL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnRollButton)); 454 return; 455 } 456 //Disconnect the button so we won't recieve new events untill we finish rolling the dice. 457 Disconnect(ID_ROLL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnRollButton)); 458 446 459 //roll the dice... 447 460 if (m_animate) { … … 490 503 (GetMenuBar()->FindItem(ID_UNDO))->Enable(false); 491 504 m_yahtzeebonus = false; //if we scored yahtzee bonus before we don't care anymore. 492 505 506 //queue the event which will cause the event-handler for clicks to be reconnected. 507 event.SetEventType(wxEVT_ENABLE_ROLL); 508 wxEvtHandler::AddPendingEvent(event); 493 509 } 494 510 -
trunk/OpenYahtzee/src/MainFrame.h
r84 r85 29 29 #ifndef MAINFRAME_INC 30 30 #define MAINFRAME_INC 31 32 DECLARE_EVENT_TYPE(wxEVT_ENABLE_ROLL, -1) 31 33 32 34 /// MainFrame class - the main window -
trunk/OpenYahtzee/src/Makefile.am
r84 r85 1 1 bin_PROGRAMS = openyahtzee 2 2 openyahtzee_SOURCES = openyahtzee.cpp MainFrame.cpp five.xpm four.xpm one.xpm \ 3 six.xpm three.xpm two.xpm DBwrapper.cpp DBwrapper.h SettingsDB.cpp \4 HighScoreTableDB.cpp HighScoreDialog.cpp SettingsDialog.cpp icon.xpm icon32.xpm \5 openyahtzee.rc wxDynamicBitmap.cpp About.cpp3 six.xpm three.xpm two.xpm DBwrapper.cpp DBwrapper.h SettingsDB.cpp \ 4 HighScoreTableDB.cpp HighScoreDialog.cpp SettingsDialog.cpp icon.xpm icon32.xpm \ 5 openyahtzee.rc wxDynamicBitmap.cpp About.cpp UtilityFunctions.cpp 6 6 7 7 # set the include path found by configure -
trunk/OpenYahtzee/src/Makefile.in
r84 r85 56 56 HighScoreTableDB.$(OBJEXT) HighScoreDialog.$(OBJEXT) \ 57 57 SettingsDialog.$(OBJEXT) wxDynamicBitmap.$(OBJEXT) \ 58 About.$(OBJEXT) 58 About.$(OBJEXT) UtilityFunctions.$(OBJEXT) 59 59 openyahtzee_OBJECTS = $(am_openyahtzee_OBJECTS) 60 60 openyahtzee_LDADD = $(LDADD) … … 186 186 target_alias = @target_alias@ 187 187 openyahtzee_SOURCES = openyahtzee.cpp MainFrame.cpp five.xpm four.xpm one.xpm \ 188 six.xpm three.xpm two.xpm DBwrapper.cpp DBwrapper.h SettingsDB.cpp \189 HighScoreTableDB.cpp HighScoreDialog.cpp SettingsDialog.cpp icon.xpm icon32.xpm \190 openyahtzee.rc wxDynamicBitmap.cpp About.cpp188 six.xpm three.xpm two.xpm DBwrapper.cpp DBwrapper.h SettingsDB.cpp \ 189 HighScoreTableDB.cpp HighScoreDialog.cpp SettingsDialog.cpp icon.xpm icon32.xpm \ 190 openyahtzee.rc wxDynamicBitmap.cpp About.cpp UtilityFunctions.cpp 191 191 192 192 … … 280 280 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SettingsDB.Po@am__quote@ 281 281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SettingsDialog.Po@am__quote@ 282 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UtilityFunctions.Po@am__quote@ 282 283 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openyahtzee.Po@am__quote@ 283 284 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wxDynamicBitmap.Po@am__quote@ -
trunk/OpenYahtzee/src/UtilityFunctions.h
r84 r85 18 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 19 19 ***************************************************************************/ 20 #include <sstream> 21 #include <wx/wx.h> 20 22 21 /**\file UtilityFunctions.h 23 22 *\brief General purpuse functions. 24 23 * 25 * This file contains the declaration and implementationfor some general24 * This file contains the declaration for some general 26 25 * purpuse utility functions. 27 26 */ 28 /**29 * This function launches the default browser and directs it to a given url.30 *31 * This function extends the wxWidgets default function for this job by checking manually for32 * different browsers if the wxWidgets' function doesn't find one. This is usually necessary33 * under linux when epiphany isn't installed for some unknown reason.34 * @param link The url that the browser will go to when it stats.35 */36 void LaunchBrowser (wxString link){37 if (!wxLaunchDefaultBrowser(link)){38 //if builtin function doesn't work search for couple of browsers manually. see39 //http://linux-consulting.buanzo.com.ar/2006/05/wxwidgets-code-to-launch-browser.html40 27 41 // variable declarations 42 wxArrayString browsers; 43 wxPathList path_list; 44 bool BrowserWasFound = false; 45 unsigned int i = 0; 46 wxString path; 28 #include <wx/wx.h> 47 29 48 // Add directories to wxPathList's search path from PATH environment variable 49 path_list.AddEnvList(wxT("PATH")); 50 51 // Add browsers filenames. First item = most priority 52 browsers.Add(wxT("firefox")); 53 browsers.Add(wxT("firefox-bin")); 54 browsers.Add(wxT("mozilla")); 55 browsers.Add(wxT("mozilla-bin")); 56 browsers.Add(wxT("opera")); 57 browsers.Add(wxT("konqueror")); 58 browsers.Add(wxT("epiphany")); 59 60 for (i = 0; i < browsers.GetCount(); i++) { 61 path = path_list.FindAbsoluteValidPath(browsers[i]); 62 if (path.IsEmpty()) { 63 continue; 64 } else { 65 BrowserWasFound = true; 66 break; 67 } 68 } 69 70 browsers.Clear(); 71 72 if (BrowserWasFound) { 73 path += wxT(" "); 74 path += link; 75 ::wxExecute(path); 76 } else { 77 wxMessageBox(wxT("No browser has been found."),wxT("OpenYahtzee")); 78 } 79 } 80 } 30 void LaunchBrowser (wxString link);
Note: See TracChangeset
for help on using the changeset viewer.
