Changeset 20


Ignore:
Timestamp:
17/12/06 11:42:56 (8 years ago)
Author:
guyru
Message:

undo button (no functioning yet)

Location:
trunk/OpenYahtzee
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpenYahtzee/Doxyfile

    r2 r20  
    44# Project related configuration options 
    55#--------------------------------------------------------------------------- 
    6 PROJECT_NAME           = openyahtzee.kdevelop 
    7 PROJECT_NUMBER         = 0.1 
    8 OUTPUT_DIRECTORY       =  
     6PROJECT_NAME           = OpenYahtzee 
     7PROJECT_NUMBER         = cvs 
     8OUTPUT_DIRECTORY       = /home/guy/workspace/OpenYahtzee 
    99CREATE_SUBDIRS         = NO 
    1010OUTPUT_LANGUAGE        = English 
     
    8181# configuration options related to the input files 
    8282#--------------------------------------------------------------------------- 
    83 INPUT                  = /home/guy/workspace/openyahtzee 
     83INPUT                  = /home/guy/workspace/OpenYahtzee 
    8484FILE_PATTERNS          = *.c \ 
    8585                         *.cc \ 
     
    128128                         *.xpm \ 
    129129                         *.dox 
    130 RECURSIVE              = yes 
    131 EXCLUDE                =  
     130RECURSIVE              = YES 
     131EXCLUDE                = /home/guy/workspace/OpenYahtzee/optimized \ 
     132                         /home/guy/workspace/OpenYahtzee/debug 
    132133EXCLUDE_SYMLINKS       = NO 
    133134EXCLUDE_PATTERNS       =  
     
    151152# configuration options related to the alphabetical class index 
    152153#--------------------------------------------------------------------------- 
    153 ALPHABETICAL_INDEX     = NO 
     154ALPHABETICAL_INDEX     = YES 
    154155COLS_IN_ALPHA_INDEX    = 5 
    155156IGNORE_PREFIX          =  
     
    208209# configuration options related to the XML output 
    209210#--------------------------------------------------------------------------- 
    210 GENERATE_XML           = yes 
     211GENERATE_XML           = YES 
    211212XML_OUTPUT             = xml 
    212213XML_SCHEMA             =  
  • trunk/OpenYahtzee/openyahtzee.kdevelop

    r17 r20  
    2929      </runarguments> 
    3030      <customdirectory>/</customdirectory> 
    31       <programargs></programargs> 
     31      <programargs/> 
    3232      <autocompile>true</autocompile> 
    3333      <envvars/> 
     
    7878      <numberofjobs>1</numberofjobs> 
    7979      <dontact>false</dontact> 
    80       <makebin></makebin> 
     80      <makebin/> 
    8181      <prio>0</prio> 
    8282    </make> 
     
    221221    <custom>false</custom> 
    222222    <bzip>false</bzip> 
    223     <archname></archname> 
     223    <archname/> 
    224224    <appname>OpenYahtzee</appname> 
    225225    <version>1.5.1</version> 
    226     <release></release> 
     226    <release/> 
    227227    <vendor>Guy Rutenberg</vendor> 
    228228    <licence>GPL</licence> 
    229     <summary></summary> 
    230     <group></group> 
    231     <packager></packager> 
    232     <description></description> 
    233     <changelog></changelog> 
     229    <summary/> 
     230    <group/> 
     231    <packager/> 
     232    <description/> 
     233    <changelog/> 
    234234    <devpackage>false</devpackage> 
    235235    <docspackage>false</docspackage> 
     
    240240    <ftpkde>false</ftpkde> 
    241241    <appskde>false</appskde> 
    242     <url></url> 
     242    <url/> 
    243243  </dist> 
    244244</kdevelop> 
  • trunk/OpenYahtzee/openyahtzee.kdevses

    r17 r20  
    22<!DOCTYPE KDevPrjSession> 
    33<KDevPrjSession> 
    4  <DocsAndViews NumberOfDocuments="1" > 
     4 <DocsAndViews NumberOfDocuments="7" > 
    55  <Doc0 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDB.h" > 
    6    <View0 line="3" Type="Source" /> 
     6   <View0 line="23" Type="Source" /> 
    77  </Doc0> 
     8  <Doc1 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/openyahtzee.cpp" > 
     9   <View0 line="0" Type="Source" /> 
     10  </Doc1> 
     11  <Doc2 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/MainFrame.cpp" > 
     12   <View0 line="86" Type="Source" /> 
     13  </Doc2> 
     14  <Doc3 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ObjectsID.h" > 
     15   <View0 line="44" Type="Source" /> 
     16  </Doc3> 
     17  <Doc4 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/MainFrame.h" > 
     18   <View0 line="80" Type="Source" /> 
     19  </Doc4> 
     20  <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/DBwrapper.h" > 
     21   <View0 line="26" Type="Source" /> 
     22  </Doc5> 
     23  <Doc6 NumberOfViews="1" URL="file:///usr/include/wx-2.6/wx/gtk/bitmap.h" > 
     24   <View0 line="74" Type="Source" /> 
     25  </Doc6> 
    826 </DocsAndViews> 
    927 <pluginList> 
    1028  <kdevdebugger> 
    1129   <breakpointList> 
    12     <breakpoint0 location="/home/guy/workspace/OpenYahtzee/src/MainFrame.cpp:224" type="1" tracingFormatString="" traceFormatStringEnabled="0" condition="" tracingEnabled="0" enabled="1" > 
     30    <breakpoint0 location="/home/guy/workspace/OpenYahtzee/src/MainFrame.cpp:228" type="1" tracingFormatString="" traceFormatStringEnabled="0" condition="" tracingEnabled="0" enabled="1" > 
    1331     <tracedExpressions/> 
    1432    </breakpoint0> 
     33    <breakpoint1 location="/home/guy/workspace/OpenYahtzee/src/MainFrame.cpp:215" type="1" tracingFormatString="" traceFormatStringEnabled="0" condition="" tracingEnabled="0" enabled="1" > 
     34     <tracedExpressions/> 
     35    </breakpoint1> 
    1536   </breakpointList> 
    1637  </kdevdebugger> 
  • trunk/OpenYahtzee/src/MainFrame.cpp

    r17 r20  
    7373        wxMenu *helpMenu = new wxMenu;  //create Help menu 
    7474         
     75         
    7576        //insert menu items into menu Help 
    7677        helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"), 
     
    7980        //insert menu items into menu File 
    8081        gameMenu->Append(ID_NEWGAME,wxT("&New Game\tF2"),wxT("Start a new game")); 
     82        //create the undo button and make it disabled 
     83        (gameMenu->Append(ID_UNDO,wxT("&Undo"),wxT("Undo the last move")))->Enable(false); 
    8184        gameMenu->Append(ID_SHOWHIGHSCORE,wxT("High &Scores"),wxT("Show high-scores table")); 
    8285        gameMenu->Append(ID_SETTINGS,wxT("Settings"),wxT("Show settings dialog")); 
    8386        gameMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), 
    8487                        wxT("Quit this program")); 
    85  
    8688         
    8789        // Declare the menu-bar and append the freshly created menus to the menu bar... 
    8890        wxMenuBar *menuBar = new wxMenuBar(); 
    8991        menuBar->Append(gameMenu, wxT("&Game")); 
    90          
    9192        menuBar->Append(helpMenu, wxT("&Help")); 
    9293         
     
    193194        Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnAbout)); 
    194195        Connect(ID_NEWGAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnNewGame)); 
     196        Connect(ID_UNDO, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnUndo)); 
    195197        Connect(ID_SHOWHIGHSCORE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnShowHighscore)); 
    196198        Connect(ID_SETTINGS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnSettings)); 
     
    214216        m_numofplaysleft = 13; 
    215217 
    216  
    217  
    218218 } 
    219219 
     
    249249        for (int i = ID_ACES; i<= ID_CHANCE; i++) 
    250250                ((wxButton*) FindWindow(i))->Enable(true); 
     251} 
     252 
     253///This function handles the undo events 
     254void MainFrame::OnUndo(wxCommandEvent& event) 
     255{ 
     256        std::cout<<"in undo"<<std::endl; 
     257        m_rolls = m_rollsundo; 
     258 
     259        //enable the roll button if neccessary 
     260        if (m_rolls > 0) //we still have remaining rolls  
     261                ((wxButton*) FindWindow(ID_ROLL)) -> Enable(true); 
     262 
     263        //reset the users last choice 
     264        FindWindow(m_lastmove)->Enable(true); 
     265        //clear the score; 
     266        ((wxTextCtrl*)FindWindow(ID_ACESTEXT + (m_lastmove - ID_ACES)))->SetValue(wxT("")); 
     267        FindWindow(ID_UNDO)->Enable(false); 
     268        m_numofplaysleft--; 
     269} 
     270///This function enables the undo button and stores the last move 
     271inline void MainFrame::EnableUndo(int id) 
     272{ 
     273                FindWindow(ID_UNDO)->Enable(true); 
     274                m_lastmove = id; 
    251275} 
    252276 
     
    531555void MainFrame::ResetRolls() 
    532556{ 
     557        m_rollsundo = m_rolls; 
    533558        m_rolls = 3; 
    534559        ((wxButton*) FindWindow(ID_ROLL)) -> Enable(true); 
  • trunk/OpenYahtzee/src/MainFrame.h

    r17 r20  
    1919 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
    2020 ***************************************************************************/ 
     21/**\file MainFrame.h 
     22 *\brief Header file for MainFrame class. 
     23 * 
     24 * This File contains the declaration of the class MainFrame 
     25*/ 
    2126 
    22  /*********************************************** 
    23  *      This File contains the declaration      * 
    24  *      of the class MainFrame                  * 
    25  ***********************************************/ 
    2627#include "SettingsDB.h" 
    2728#include "HighScoreTableDB.h" 
     
    2930#define MAINFRAME_INC 
    3031 
    31 // Declare our main frame class 
     32/// MainFrame class - the main window 
     33/** 
     34The Main Frame class is a derieved class from wxFrame which is responsible to  
     35the main window of the application. This class also hold all the functions  
     36that process the dice and handles the gameplay. This function are called as 
     37event handlers. 
     38*/ 
    3239class MainFrame : public wxFrame 
    3340{ 
     
    4047        void OnAbout(wxCommandEvent& event); 
    4148        void OnNewGame (wxCommandEvent& event); 
     49        void OnUndo (wxCommandEvent& event); 
    4250        void OnShowHighscore (wxCommandEvent& event); 
    4351        void OnSettings (wxCommandEvent& event); 
     
    6169        void EndofGame(); 
    6270        void HighScoreHandler(int score); 
     71        inline void EnableUndo(int id); 
    6372 
    6473        //pointers to hold bitmap data for the dices 
     
    7180        bool m_yahtzee; 
    7281 
    73         SettingsDB *m_settingsdb; ///handles the settings database 
    74         HighScoreTableDB *m_highscoredb; ///handles the highscore database managment 
     82        short int m_lastmove; //stores the ID of the last button pressed. 
     83        short int m_rollsundo; //holds the number of remaining rolls for use with the undo option 
     84 
     85        SettingsDB *m_settingsdb; //handles the settings database 
     86        HighScoreTableDB *m_highscoredb; //handles the highscore database managment 
    7587 
    7688}; 
  • trunk/OpenYahtzee/src/ObjectsID.h

    r17 r20  
    2525        ID_PANEL, 
    2626        ID_NEWGAME, 
     27        ID_UNDO, 
    2728        ID_SHOWHIGHSCORE, 
    2829        ID_SETTINGS, 
Note: See TracChangeset for help on using the changeset viewer.