Changeset 51


Ignore:
Timestamp:
16/01/07 14:10:45 (6 years ago)
Author:
guyru
Message:

* empty log message *

Location:
trunk/OpenYahtzee
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpenYahtzee/ChangeLog

    r50 r51  
    1010- Fixed bug #1634542 (undoing of scoring that involves Yahtzee Bonus). 
    1111- Fixed minor misalignment in the UI. 
     12- Code refactoring and cleanup. 
     13- Redesigned the Settings Dialog. 
     14- The main window of the game is now unresizable (fixed size). 
    1215 
    1316Open Yahtzee 1.6: 
  • trunk/OpenYahtzee/TODO

    r47 r51  
    77- Disable the ability to undo the last move of the game. 
    88- Add abilliy to adjust how many times (avreage) will the dice roll before they stop. 
    9 - Change the "reset high score" toggle button to a checkbox. 
    109- Multiplayer mode. 
    1110 
     
    1514- Add a frame around the dices. 
    1615- Make the dice roll a couple of times before they stop. 
     16- Change the "reset high score" toggle button to a checkbox. 
    1717 
    1818 
  • trunk/OpenYahtzee/src/MainFrame.cpp

    r50 r51  
    239239        Connect(ID_ROLL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnRollButton)); 
    240240 
    241         for (int i=ID_ACES; i<=ID_SIXES; i++) 
    242                 Connect(i, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnUpperButtons)); 
     241        Connect(ID_ACES,ID_SIXES, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::OnUpperButtons)); 
    243242        Connect(ID_THREEOFAKIND, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::On3ofakindButton)); 
    244243        Connect(ID_FOUROFAKIND, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (MainFrame::On4ofakindButton)); 
  • trunk/OpenYahtzee/src/SettingsDialog.cpp

    r47 r51  
    2929 
    3030SettingsDialog::SettingsDialog(wxWindow* parent, int id): 
    31     wxDialog(parent, wxID_ANY, wxT("Settins Dialog"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) 
     31    wxDialog(parent, wxID_ANY, wxT("Settings Dialog"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) 
    3232{ 
    3333 
    3434        SetIcon(wxIcon(ICON)); 
    3535 
    36         label_1 = new wxStaticText(this, -1, wxT("High-score table size:")); 
     36        label_1 = new wxStaticText(this, -1, wxT("High score table size:")); 
    3737        spin_ctrl = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS,0,1024,20); 
    38         button_3 = new wxToggleButton(this, ID_RESETHIGHSCORE, wxT("reset high-score table")); 
    39         button_1 = new wxButton(this, wxID_OK); 
    40         button_2 = new wxButton(this, wxID_CANCEL); 
     38        checkbox_reset = new wxCheckBox(this, ID_RESETHIGHSCORE, wxT("Reset high score table")); 
    4139        animate_checkbox = new wxCheckBox(this, ID_ANIMATECHECKBOX, wxT("Animate dice")); 
    4240 
    43         set_properties(); 
     41        connect_event_table(); 
    4442        do_layout(); 
    4543        // end wxGlade 
    4644} 
    4745 
    48 BEGIN_EVENT_TABLE( SettingsDialog, wxDialog) 
    49         EVT_TOGGLEBUTTON(ID_RESETHIGHSCORE, SettingsDialog::OnResetHighScore) 
    50 END_EVENT_TABLE(); 
    5146 
    52 void SettingsDialog::set_properties() 
     47void SettingsDialog::connect_event_table() 
    5348{ 
    54     // begin wxGlade: SettingsDialog::set_properties 
    55     //SetTitle(wxT("Settings Dialog")); /*unneeded anymore -guy*/ 
    56     //button_1->SetDefault();/*unneeded anymore -guy*/ 
    57     // end wxGlade 
     49   Connect(ID_RESETHIGHSCORE,wxEVT_COMMAND_CHECKBOX_CLICKED,wxCommandEventHandler(SettingsDialog::OnResetHighScore)); 
    5850} 
    5951 
     
    6254{ 
    6355        wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); 
    64         wxBoxSizer* sizer_2 = new wxBoxSizer(wxHORIZONTAL); 
    6556        wxBoxSizer* highscoresizer = new wxBoxSizer(wxHORIZONTAL); 
    66         highscoresizer->Add(label_1, 0, wxALL|wxADJUST_MINSIZE, 10); 
    67         highscoresizer->Add(spin_ctrl, 0, wxALL|wxADJUST_MINSIZE, 10); 
     57 
     58        highscoresizer->Add(label_1, 0, wxALL|wxADJUST_MINSIZE, 5); 
     59        highscoresizer->Add(spin_ctrl, 0, wxALL|wxADJUST_MINSIZE, 5); 
    6860        top_sizer->Add(highscoresizer, 0, 0, 0); 
    69         top_sizer->Add(button_3, 0,wxALL|wxALIGN_RIGHT|wxADJUST_MINSIZE, 10); 
     61        top_sizer->Add(checkbox_reset, 0,wxALL, 5); 
    7062 
    71         top_sizer->Add(animate_checkbox,0,wxALL,10); 
     63        top_sizer->Add(animate_checkbox,0,wxALL,5); 
    7264 
    73         sizer_2->Add(button_1, 0, wxALL|wxADJUST_MINSIZE, 10); 
    74         sizer_2->Add(button_2, 0, wxALL|wxADJUST_MINSIZE, 10); 
    75         top_sizer->Add(sizer_2, 1, 0, 0); 
     65        top_sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 1, wxBOTTOM, 10); 
    7666        SetAutoLayout(true); 
    7767        SetSizer(top_sizer); 
     
    8474void SettingsDialog::OnResetHighScore(wxCommandEvent& event) 
    8575{ 
    86         if(!button_3->GetValue()){ 
    87                 button_3->SetValue(0); 
     76        if(!checkbox_reset->GetValue()){ 
     77                checkbox_reset->SetValue(0); 
    8878                return; 
    8979        } 
    9080         
    91         int answer = wxMessageBox(wxT("Are you sure you want to reset the high-score table? After reseting the high score table, you won't be able to restore it!\nThe new high-score table size will be as specified in this dialog."),wxT("High-score table reset"),wxYES_NO|wxICON_EXCLAMATION); 
     81        int answer = wxMessageBox(wxT("Are you sure you want to reset the high score table? After reseting the high score table, you won't be able to restore it!\n\nThe new high score table size will be as specified in this dialog."),wxT("High-score table reset"),wxYES_NO|wxICON_EXCLAMATION,this); 
    9282 
    9383        if(answer==wxNO) 
    94                 button_3->SetValue(0); 
     84                checkbox_reset->SetValue(0); 
    9585} 
    9686 
     
    10595        SettingsDialogData data; 
    10696        data.highscoresize = spin_ctrl->GetValue(); 
    107         data.reset = button_3->GetValue(); 
     97        data.reset = checkbox_reset->GetValue(); 
    10898        data.animate = animate_checkbox->GetValue(); 
    10999        return data; 
  • trunk/OpenYahtzee/src/SettingsDialog.h

    r46 r51  
    5353private: 
    5454    // begin wxGlade: SettingsDialog::methods 
    55     void set_properties(); 
     55    void connect_event_table(); 
    5656    void do_layout(); 
    5757    // end wxGlade 
     
    6363        wxStaticText* label_1; 
    6464        wxSpinCtrl* spin_ctrl; 
    65         wxToggleButton* button_3; //the reset button 
    66         wxButton* button_1; 
    67         wxButton* button_2; 
     65        wxCheckBox* checkbox_reset; //the reset button 
    6866         
    6967        wxCheckBox* animate_checkbox; 
    70  
    71         DECLARE_EVENT_TABLE(); 
    7268         
    7369}; 
  • trunk/OpenYahtzee/src/openyahtzee.cpp

    r38 r51  
    5454 
    5555        // Create the main application window 
    56         MainFrame *frame = new MainFrame(wxT("OpenYahtzee"), wxDefaultSize, wxDEFAULT_FRAME_STYLE); 
     56        MainFrame *frame = new MainFrame(wxT("OpenYahtzee"), wxDefaultSize, wxDEFAULT_FRAME_STYLE & (~wxRESIZE_BORDER)); 
    5757         
    5858        //Show it 
  • trunk/OpenYahtzee/src/wxDynamicBitmap.h

    r48 r51  
    4141        wxDynamicBitmap (wxWindow* parent, wxWindowID id, wxBitmap&  bitmap, 
    4242                 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 
    43                  long style = 0, const wxString& name = wxPanelNameStr); 
     43                 long style = wxNO_BORDER, const wxString& name = wxPanelNameStr); 
    4444        virtual void SetBitmap(wxBitmap&  bitmap); 
    4545        wxBitmap GetBitmap(); 
Note: See TracChangeset for help on using the changeset viewer.