Changeset 58
- Timestamp:
- 26/01/07 22:18:07 (6 years ago)
- Location:
- trunk/OpenYahtzee
- Files:
-
- 6 edited
-
openyahtzee.kdevelop.pcs (modified) (previous)
-
openyahtzee.kdevses (modified) (5 diffs)
-
src/MainFrame.cpp (modified) (7 diffs)
-
src/MainFrame.h (modified) (2 diffs)
-
src/SettingsDialog.cpp (modified) (4 diffs)
-
src/SettingsDialog.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/OpenYahtzee/openyahtzee.kdevses
r57 r58 2 2 <!DOCTYPE KDevPrjSession> 3 3 <KDevPrjSession> 4 <DocsAndViews NumberOfDocuments="1 7" >4 <DocsAndViews NumberOfDocuments="16" > 5 5 <Doc0 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDB.h" > 6 6 <View0 Type="Source" /> … … 10 10 </Doc1> 11 11 <Doc2 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/MainFrame.cpp" > 12 <View0 line=" 121" Type="Source" />12 <View0 line="407" Type="Source" /> 13 13 </Doc2> 14 14 <Doc3 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ObjectsID.h" > 15 <View0 line="30"Type="Source" />15 <View0 Type="Source" /> 16 16 </Doc3> 17 17 <Doc4 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/MainFrame.h" > 18 <View0 line=" 52" Type="Source" />18 <View0 line="95" Type="Source" /> 19 19 </Doc4> 20 20 <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/DBwrapper.h" > … … 25 25 </Doc6> 26 26 <Doc7 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDialog.cpp" > 27 <View0 Type="Source" />27 <View0 line="93" Type="Source" /> 28 28 </Doc7> 29 29 <Doc8 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDB.cpp" > … … 36 36 <View0 Type="Source" /> 37 37 </Doc10> 38 <Doc11 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ Icon.h" >39 <View0 Type="Source" />38 <Doc11 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDialog.h" > 39 <View0 line="39" Type="Source" /> 40 40 </Doc11> 41 <Doc12 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ SettingsDialog.h" >41 <Doc12 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/wxDynamicBitmap.cpp" > 42 42 <View0 Type="Source" /> 43 43 </Doc12> 44 <Doc13 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ wxDynamicBitmap.cpp" >44 <Doc13 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/DBwrapper.cpp" > 45 45 <View0 Type="Source" /> 46 46 </Doc13> 47 <Doc14 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ DBwrapper.cpp" >47 <Doc14 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/wxDynamicBitmap.h" > 48 48 <View0 Type="Source" /> 49 49 </Doc14> 50 <Doc15 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ wxDynamicBitmap.h" >51 <View0 Type="Source" />50 <Doc15 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/openyahtzee.rc" > 51 <View0 line="0" Type="Source" /> 52 52 </Doc15> 53 <Doc16 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/openyahtzee.rc" >54 <View0 line="0" Type="Source" />55 </Doc16>56 53 </DocsAndViews> 57 54 <pluginList> … … 61 58 <kdevbookmarks> 62 59 <bookmarks> 63 <bookmark url="/home/guy/workspace/OpenYah ztee/src/MainFrame.cpp" >64 <mark line=" 596" />60 <bookmark url="/home/guy/workspace/OpenYahtzee/src/MainFrame.cpp" > 61 <mark line="108" /> 65 62 </bookmark> 66 63 </bookmarks> -
trunk/OpenYahtzee/src/MainFrame.cpp
r57 r58 86 86 m_animate = true; 87 87 } 88 if (m_settingsdb->GetKey("calculatesubtotal") == "Yes") { 89 m_calculatesubtotal = true; 90 } else if (m_settingsdb->GetKey("calculatesubtotal") == "No") { 91 m_calculatesubtotal = false; 92 } else { 93 m_settingsdb->SetKey("calculatesubtotal", "Yes"); 94 m_calculatesubtotal = true; 95 } 88 96 89 97 // END Database initialization … … 145 153 wxSizer *lowersection = new wxStaticBoxSizer( new wxStaticBox( panel, wxID_ANY, wxT("Lower Section") ), wxVERTICAL); 146 154 147 wxFlexGridSizer* uppergrid = new wxFlexGridSizer( 9, 2, 0,0);148 wxFlexGridSizer* lowergrid = new wxFlexGridSizer( 9, 2, 0,0);155 wxFlexGridSizer* uppergrid = new wxFlexGridSizer(2, 0, 10); 156 wxFlexGridSizer* lowergrid = new wxFlexGridSizer(2, 0, 10); 149 157 150 158 … … 343 351 } 344 352 353 //recalculate the subtotals 354 CalculateSubTotal(); 355 345 356 (GetMenuBar()->FindItem(ID_UNDO))->Enable(false); 346 357 //cancel the counting for the choice that was canceled … … 371 382 372 383 data.animate = (m_settingsdb->GetKey("animate")=="Yes")?true:false; 384 data.subtotal = (m_settingsdb->GetKey("calculatesubtotal")=="Yes")?true:false; 373 385 374 386 dialog->SetData(data); … … 391 403 m_settingsdb->SetKey("animate","No"); 392 404 m_animate = false; 405 } 406 if (data.subtotal){ 407 m_settingsdb->SetKey("calculatesubtotal","Yes"); 408 m_calculatesubtotal = true; 409 410 } else { 411 m_settingsdb->SetKey("calculatesubtotal","No"); 412 m_calculatesubtotal = false; 393 413 } 394 414 … … 757 777 ResetRolls(); 758 778 779 CalculateSubTotal(); 780 759 781 //and disable the button 760 782 FindWindow(id)->Enable(false); … … 762 784 EnableUndo(id); 763 785 EndofGame(); 786 } 787 788 void MainFrame::CalculateSubTotal() 789 { 790 if (!m_calculatesubtotal) 791 return; 792 long upperscore = 0; 793 long lowerscore = 0; 794 wxString tempstr; 795 long temp; 796 797 798 for (int i = ID_ACESTEXT; i<=ID_SIXESTEXT; i++){ 799 tempstr = ((wxTextCtrl*) FindWindow(i)) -> GetValue(); 800 tempstr.ToLong(&temp,10); 801 upperscore +=temp; 802 } 803 804 tempstr.Printf(wxT("%i"),upperscore); 805 ((wxTextCtrl*) FindWindow(ID_UPPERSECTIONTOTAL)) -> SetValue(tempstr); 806 807 for (int i = ID_THREEOFAKINDTEXT; i<=ID_YAHTZEEBONUSTEXT; i++) { 808 tempstr = ((wxTextCtrl*) FindWindow(i)) -> GetValue(); 809 tempstr.ToLong(&temp,10); 810 lowerscore +=temp; 811 } 812 813 tempstr.Printf(wxT("%i"),lowerscore); 814 ((wxTextCtrl*) FindWindow(ID_LOWERTOTAL)) -> SetValue(tempstr); 764 815 } 765 816 -
trunk/OpenYahtzee/src/MainFrame.h
r57 r58 74 74 inline void EnableUndo(int id); 75 75 void PostScore(int id); 76 void CalculateSubTotal(); 76 77 void LaunchBrowser (wxString link); 77 78 … … 93 94 94 95 bool m_animate; //sets whether to animate the dice. 96 bool m_calculatesubtotal; //sets whether to calculate the subtotal after every score or not 95 97 96 98 }; -
trunk/OpenYahtzee/src/SettingsDialog.cpp
r51 r58 38 38 checkbox_reset = new wxCheckBox(this, ID_RESETHIGHSCORE, wxT("Reset high score table")); 39 39 animate_checkbox = new wxCheckBox(this, ID_ANIMATECHECKBOX, wxT("Animate dice")); 40 subtotal_checkbox = new wxCheckBox(this, wxID_ANY, wxT("Calculate sub-total score for the upper and lower sections")); 41 40 42 41 43 connect_event_table(); … … 56 58 wxBoxSizer* highscoresizer = new wxBoxSizer(wxHORIZONTAL); 57 59 58 highscoresizer->Add(label_1, 0, wxALL |wxADJUST_MINSIZE, 5);59 highscoresizer->Add(spin_ctrl, 0, wxALL |wxADJUST_MINSIZE, 5);60 highscoresizer->Add(label_1, 0, wxALL, 5); 61 highscoresizer->Add(spin_ctrl, 0, wxALL, 5); 60 62 top_sizer->Add(highscoresizer, 0, 0, 0); 61 63 top_sizer->Add(checkbox_reset, 0,wxALL, 5); 62 64 63 65 top_sizer->Add(animate_checkbox,0,wxALL,5); 66 top_sizer->Add(subtotal_checkbox,0,wxALL,5); 64 67 65 68 top_sizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 1, wxBOTTOM, 10); … … 89 92 spin_ctrl->SetValue(data.highscoresize); 90 93 animate_checkbox->SetValue(data.animate); 94 subtotal_checkbox->SetValue(data.subtotal); 91 95 } 92 96 … … 97 101 data.reset = checkbox_reset->GetValue(); 98 102 data.animate = animate_checkbox->GetValue(); 103 data.subtotal = subtotal_checkbox->GetValue(); 99 104 return data; 100 105 } -
trunk/OpenYahtzee/src/SettingsDialog.h
r51 r58 38 38 bool reset; 39 39 bool animate; 40 bool subtotal; 40 41 }; 41 42 … … 66 67 67 68 wxCheckBox* animate_checkbox; 69 wxCheckBox* subtotal_checkbox; 68 70 69 71 };
Note: See TracChangeset
for help on using the changeset viewer.
