Deleted skiping of events and some refactoring
This commit is contained in:
@@ -54,7 +54,7 @@ void readGrid(wxString path, GridType &grid){
|
|||||||
wxLogDebug(str);
|
wxLogDebug(str);
|
||||||
for (unsigned int j = 0; j < str.size(); ++j)
|
for (unsigned int j = 0; j < str.size(); ++j)
|
||||||
grid.at(j).at(i) = str.at(j);
|
grid.at(j).at(i) = str.at(j);
|
||||||
i++;
|
++i;
|
||||||
}
|
}
|
||||||
wxLogDebug(wxT("Прочитана сетка размером %d x %d"),
|
wxLogDebug(wxT("Прочитана сетка размером %d x %d"),
|
||||||
static_cast<int>(grid.size()), static_cast<int>(grid.at(0).size()));
|
static_cast<int>(grid.size()), static_cast<int>(grid.at(0).size()));
|
||||||
@@ -80,10 +80,10 @@ void generateWordInfo(GridType &grid, std::vector<WordInfo> &winfos){
|
|||||||
size_t cur_len = 1;
|
size_t cur_len = 1;
|
||||||
bool cont = true;
|
bool cont = true;
|
||||||
while ((j + cur_len < grid.at(0).size()) && cont){
|
while ((j + cur_len < grid.at(0).size()) && cont){
|
||||||
cur_len++;
|
++cur_len;
|
||||||
if (grid.at(i).at(j+cur_len-1) != CELL_CLEAR){
|
if (grid.at(i).at(j+cur_len-1) != CELL_CLEAR){
|
||||||
cont = false;
|
cont = false;
|
||||||
cur_len--;
|
--cur_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exist = true;
|
exist = true;
|
||||||
@@ -102,7 +102,7 @@ void generateWordInfo(GridType &grid, std::vector<WordInfo> &winfos){
|
|||||||
size_t cur_len = 1;
|
size_t cur_len = 1;
|
||||||
bool cont = true;
|
bool cont = true;
|
||||||
while ((i + cur_len < grid.size()) && cont){
|
while ((i + cur_len < grid.size()) && cont){
|
||||||
cur_len++;
|
++cur_len;
|
||||||
if (grid.at(i+cur_len-1).at(j) != CELL_CLEAR){
|
if (grid.at(i+cur_len-1).at(j) != CELL_CLEAR){
|
||||||
cont = false;
|
cont = false;
|
||||||
cur_len--;
|
cur_len--;
|
||||||
@@ -119,7 +119,7 @@ void generateWordInfo(GridType &grid, std::vector<WordInfo> &winfos){
|
|||||||
}
|
}
|
||||||
if (exist){
|
if (exist){
|
||||||
exist = false;
|
exist = false;
|
||||||
cur_ind++;
|
++cur_ind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,17 +31,14 @@ MainFrame::MainFrame(wxWindow* parent, int id, const wxString& title, const wxPo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainFrame::set_properties()
|
void MainFrame::set_properties() {
|
||||||
{
|
|
||||||
SetTitle(_("Генератор кроссвордов"));
|
SetTitle(_("Генератор кроссвордов"));
|
||||||
SetSize(wxSize(700, 500));
|
SetSize(wxSize(700, 500));
|
||||||
SetMinSize(wxSize(600,340));
|
SetMinSize(wxSize(600,340));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainFrame::do_layout()
|
void MainFrame::do_layout() {
|
||||||
{
|
|
||||||
// begin wxGlade: MainFrame::do_layout
|
|
||||||
wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
|
||||||
wxBoxSizer* sizer_4 = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* sizer_4 = new wxBoxSizer(wxHORIZONTAL);
|
||||||
wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL);
|
||||||
@@ -59,7 +56,6 @@ void MainFrame::do_layout()
|
|||||||
sizer_1->Add(sizer_4, 0, wxEXPAND, 0);
|
sizer_1->Add(sizer_4, 0, wxEXPAND, 0);
|
||||||
SetSizer(sizer_1);
|
SetSizer(sizer_1);
|
||||||
Layout();
|
Layout();
|
||||||
// end wxGlade
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -69,8 +65,7 @@ BEGIN_EVENT_TABLE(MainFrame, wxFrame)
|
|||||||
END_EVENT_TABLE();
|
END_EVENT_TABLE();
|
||||||
|
|
||||||
void MainFrame::OnbtnPathClick(wxCommandEvent &event) {
|
void MainFrame::OnbtnPathClick(wxCommandEvent &event) {
|
||||||
event.Skip();
|
wxFileDialog dlgOpen(this, wxT("Открыть файл кроссворда"), wxEmptyString, wxEmptyString,
|
||||||
wxFileDialog dlgOpen(this, wxT("Open XYZ file"), wxEmptyString, wxEmptyString,
|
|
||||||
wxT("Файлы кроссворда (*.cross)|*.cross"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
wxT("Файлы кроссворда (*.cross)|*.cross"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
|
||||||
|
|
||||||
if (dlgOpen.ShowModal() == wxID_CANCEL)
|
if (dlgOpen.ShowModal() == wxID_CANCEL)
|
||||||
@@ -160,8 +155,6 @@ void MainFrame::SetGridImage(GridType &grid, size_t w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::OnbtnGenerateClick(wxCommandEvent &event) {
|
void MainFrame::OnbtnGenerateClick(wxCommandEvent &event) {
|
||||||
event.Skip();
|
|
||||||
|
|
||||||
if ( !_isDictLoaded ) {
|
if ( !_isDictLoaded ) {
|
||||||
readDict(wxT("big_cross_ru.txt"), _dict);
|
readDict(wxT("big_cross_ru.txt"), _dict);
|
||||||
_isDictLoaded = true;
|
_isDictLoaded = true;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ CurrentFileName :=
|
|||||||
CurrentFilePath :=
|
CurrentFilePath :=
|
||||||
CurrentFileFullPath :=
|
CurrentFileFullPath :=
|
||||||
User :=Aleksey Lobanov
|
User :=Aleksey Lobanov
|
||||||
Date :=06/06/15
|
Date :=07/06/15
|
||||||
CodeLitePath :="/home/alex/.codelite"
|
CodeLitePath :="/home/alex/.codelite"
|
||||||
LinkerName :=/usr/bin/g++-4.8
|
LinkerName :=/usr/bin/g++-4.8
|
||||||
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC
|
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC
|
||||||
|
|||||||
Reference in New Issue
Block a user