Changeset 85


Ignore:
Timestamp:
21/05/07 17:28:04 (6 years ago)
Author:
guyru
Message:
Location:
trunk/OpenYahtzee
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpenYahtzee/openyahtzee.kdevses

    r84 r85  
    22<!DOCTYPE KDevPrjSession> 
    33<KDevPrjSession> 
    4  <DocsAndViews NumberOfDocuments="10" > 
     4 <DocsAndViews NumberOfDocuments="8" > 
    55  <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" > 
    69   <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" /> 
    1010  </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" /> 
    1313  </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" /> 
    1616  </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" /> 
    1919  </Doc4> 
    20   <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/MainFrame.cpp" > 
    21    <View0 line="36" Type="Source" /> 
     20  <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/UtilityFunctions.h" > 
     21   <View0 line="30" Type="Source" /> 
    2222  </Doc5> 
    23   <Doc6 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/MainFrame.h" > 
    24    <View0 line="20" Type="Source" /> 
     23  <Doc6 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/UtilityFunctions.cpp" > 
     24   <View0 line="23" Type="Source" /> 
    2525  </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" /> 
    2828  </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> 
    3529 </DocsAndViews> 
    3630 <pluginList> 
  • trunk/OpenYahtzee/src/MainFrame.cpp

    r84 r85  
    5656#define DEF_HIGHSCORESIZE 20 
    5757#define OY_VERSION "1.7.0" 
     58 
     59DEFINE_EVENT_TYPE(wxEVT_ENABLE_ROLL) 
     60 
    5861 
    5962MainFrame::MainFrame(const wxString& title, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE) 
     
    231234 
    232235        Connect(ID_ROLL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnRollButton)); 
     236        Connect(ID_ROLL, wxEVT_ENABLE_ROLL, wxCommandEventHandler (MainFrame::OnRollButton)); 
    233237 
    234238        //BEGIN connecting the scoreboard buttons to the events 
     
    444448void MainFrame::OnRollButton (wxCommandEvent& event) 
    445449{ 
     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 
    446459        //roll the dice... 
    447460        if (m_animate) { 
     
    490503        (GetMenuBar()->FindItem(ID_UNDO))->Enable(false); 
    491504        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); 
    493509} 
    494510 
  • trunk/OpenYahtzee/src/MainFrame.h

    r84 r85  
    2929#ifndef MAINFRAME_INC 
    3030#define MAINFRAME_INC 
     31 
     32DECLARE_EVENT_TYPE(wxEVT_ENABLE_ROLL, -1) 
    3133 
    3234/// MainFrame class - the main window 
  • trunk/OpenYahtzee/src/Makefile.am

    r84 r85  
    11bin_PROGRAMS = openyahtzee 
    22openyahtzee_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.cpp 
     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.cpp UtilityFunctions.cpp 
    66 
    77# set the include path found by configure 
  • trunk/OpenYahtzee/src/Makefile.in

    r84 r85  
    5656        HighScoreTableDB.$(OBJEXT) HighScoreDialog.$(OBJEXT) \ 
    5757        SettingsDialog.$(OBJEXT) wxDynamicBitmap.$(OBJEXT) \ 
    58         About.$(OBJEXT) 
     58        About.$(OBJEXT) UtilityFunctions.$(OBJEXT) 
    5959openyahtzee_OBJECTS = $(am_openyahtzee_OBJECTS) 
    6060openyahtzee_LDADD = $(LDADD) 
     
    186186target_alias = @target_alias@ 
    187187openyahtzee_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.cpp 
     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.cpp UtilityFunctions.cpp 
    191191 
    192192 
     
    280280@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SettingsDB.Po@am__quote@ 
    281281@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SettingsDialog.Po@am__quote@ 
     282@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UtilityFunctions.Po@am__quote@ 
    282283@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openyahtzee.Po@am__quote@ 
    283284@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wxDynamicBitmap.Po@am__quote@ 
  • trunk/OpenYahtzee/src/UtilityFunctions.h

    r84 r85  
    1818 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
    1919 ***************************************************************************/ 
    20 #include <sstream> 
    21 #include <wx/wx.h> 
     20 
    2221/**\file UtilityFunctions.h 
    2322 *\brief General purpuse functions. 
    2423 * 
    25  * This file contains the declaration and implementation for some general 
     24 * This file contains the declaration for some general 
    2625 * purpuse utility functions. 
    2726*/ 
    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 for 
    32  * different browsers if the wxWidgets' function doesn't find one. This is usually necessary  
    33  * 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. see 
    39                  //http://linux-consulting.buanzo.com.ar/2006/05/wxwidgets-code-to-launch-browser.html 
    4027 
    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> 
    4729 
    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 } 
     30void LaunchBrowser (wxString link); 
Note: See TracChangeset for help on using the changeset viewer.