Code: Select all
MyFramebearb::MyFramebearb(wxWindow* parent, const wxString& title, int x, int y, int w, int h):
wxFrame(parent, wxID_bearb, title, wxPoint(x, y), wxSize(w, h))
{
panel = new wxScrolledWindow(this, wxID_ANY, wxPoint(x, y), wxSize(w, h));
mybuild = new wxScrolledWindow(panel, wxID_ANY, wxPoint(x, y), wxSize(w, h - 200));
mainsizer = new wxBoxSizer(wxHORIZONTAL);
mainsizer->AddSpacer(7);
wxBoxSizer* row_sizer[400];
wxInt16 count;
count = 1;
wxSQLite3ResultSet set, set3;
wxString help;
help << bearbvn;
if (ord_wnum == "yes")
{
set = h_dbi[subibi[sucwin]].ExecuteQuery(wxS("SELECT * FROM bibel where versnum=" + help + " order by wnum;"));
}
else
{
set = h_dbi[subibi[sucwin]].ExecuteQuery(wxS("SELECT * FROM bibel where versnum=" + help + " order by wnum2;"));
}
while (set.NextRow())
{
wxSQLite3ResultSet set2;
help2[count] = set.GetAsString(0);
help2[count] = help2[count].Left(help2[count].Length() - 2);
myspez[count] = set.GetAsString(7);
myword[count] = set.GetAsString(8);
mywnum[count] = set.GetAsString(9);
mywnum[count] = mywnum[count].Left(mywnum[count].Length() - 2);
mystron[count] = set.GetAsString(6);
myxref[count]= set.GetAsString(10);
mynote[count] = set.GetAsString(11);
wxString ref_help, ref_help2;
ref_help2 = myxref[count];
while (ref_help2.Length() > 0)
{
wxString ref_help3;
if (ref_help2.find(";") > 0)
{
ref_help3 = ref_help2.Left(ref_help2.Find(";"));
ref_help2 = ref_help2.Right(ref_help2.Length() - ref_help2.Find(";")-1);
}
else
{
ref_help3 = ref_help2;
ref_help2 = "";
}
wxString ref_help4;
wxInt16 ref_help5;
ref_help4 = ref_help3.Left(ref_help3.Find("."));
ref_help3 = ref_help3.Right(ref_help3.Length() - ref_help3.Find(".")-1);
ref_help3.Replace(".", ";");
ref_help5 = wxAtoi(ref_help4);
ref_help = ref_help+bushnam[ref_help5] + " " + ref_help3+";";
}
myxref[count] = ref_help;
set2 = h_dbi[5].ExecuteQuery(wxS("SELECT * FROM bibel where wnum=" + help2[count] + ";"));
if (set2.NextRow())
{
mymorp[count] = set2.GetAsString(8);
}
set3 = h_ddi->ExecuteQuery(wxS("SELECT * FROM topics where subject='" + mystron[count] + "';"));
wxString newh;
newh = set3.GetAsString(0);
set3 = h_ddi->ExecuteQuery(wxS("SELECT * FROM content where topic_id=" + newh + ";"));
wxString longstron;
longstron = set3.GetAsString(2);
mydata[count] = longstron;
count++;
}
count = 1;
wxInt16 addc = 0;
while (count<11){
row_sizer[count] = new wxBoxSizer(wxVERTICAL);
addc = 0;
while (help2[count + addc * 10] != "") {
my_bib[count + addc * 10] = new wxTextCtrl(mybuild, wxID_ANY, myword[count + addc * 10], wxDefaultPosition, wxSize(150, 25), wxTE_PROCESS_ENTER);
my_bib[count + addc * 10]->Bind(wxEVT_SET_FOCUS, &MyFramebearb::Onsetf,this);
wxFont myFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
my_bib[count + addc * 10]->SetFont(myFont);
row_sizer[count]->Add(my_bib[count + addc * 10]);
my_wnum2[count + addc * 10] = new wxTextCtrl(mybuild, wxID_ANY, mywnum[count + addc * 10], wxDefaultPosition, wxSize(150, 20));
row_sizer[count]->Add(my_wnum2[count + addc * 10]);
my_stat = new wxStaticText(mybuild, wxID_ANY, help2[count + addc * 10], wxDefaultPosition, wxSize(150, 20), wxALIGN_CENTRE_HORIZONTAL);
row_sizer[count]->Add(my_stat);
wxColor mycol;
mycol.Set("#B8860B");
my_stat2 = new wxStaticText(mybuild, wxID_ANY, mymorp[count + addc * 10], wxDefaultPosition, wxSize(150,45), wxALIGN_CENTRE_HORIZONTAL);
my_stat2->SetForegroundColour(mycol);
row_sizer[count]->Add(my_stat2);
my_stat3 = new wxStaticText(mybuild, wxID_ANY, mystron[count + addc * 10], wxDefaultPosition, wxSize(150, 20), wxALIGN_CENTRE_HORIZONTAL);
mycol.Set("#"+strcolor);
//wxColor(51, 102, 255)
my_stat3->SetForegroundColour(mycol);
row_sizer[count]->Add(my_stat3);
my_xref[count + addc * 10] = new wxTextCtrl(mybuild, wxID_ANY, myxref[count + addc * 10], wxDefaultPosition, wxSize(150, 20));
row_sizer[count]->Add(my_xref[count + addc * 10]);
my_note[count + addc * 10] = new wxTextCtrl(mybuild, wxID_ANY, mynote[count + addc * 10],wxDefaultPosition,wxSize(150,20));
row_sizer[count]->Add(my_note[count + addc * 10]);
// my_stat6 = new wxStaticText(mybuild, wxID_ANY, mymean[count + addc * 10]);
// row_sizer[count]->Add(my_stat6);
wxStringInputStream in{ mydata[count + addc * 10] };
wxRichTextXMLHandler handler2;
row_sizer[count]->AddSpacer(7);
m_toolbe[count] = new wxRichTextCtrl(mybuild, wxID_ANY, "test ");
m_toolbe[count]->SuppressingUndo();
if (!handler2.LoadFile(&m_toolbe[count]->GetBuffer(), in))
{
throw std::runtime_error{ "Failed to set the contents of wxRichTextCtrl!" };
}
m_toolbe[count]->LayoutContent();
m_toolbe[count]->PositionCaret();
m_toolbe[count]->SetupScrollbars(true);
m_toolbe[count]->Refresh(true);
m_toolbe[count]->SetInitialSize(wxSize(150, 100));
m_toolbe[count]->SetEditable(false);
// m_toolbe->SetScrollPos(wxVERTICAL, 500, true);
wxLongLong mlinb;
mlinb = 0;
wxString smean;
wxInt16 mlinb2 = 100;
m_toolbe[count]->SelectWord(mlinb2);
smean = m_toolbe[count]->GetStringSelection();
while (smean != "Definition")
{
mlinb2=mlinb2 + 5;
m_toolbe[count]->SelectWord(mlinb2);
smean = m_toolbe[count]->GetStringSelection();
}
m_toolbe[count]->ShowPosition(mlinb2);
m_toolbe[count]->ScrollLines(15);
m_toolbe[count]->SetSelectionRange(wxRichTextRange(0, 0));
m_toolbe[count]->Update();
row_sizer[count]->Add(m_toolbe[count]);
row_sizer[count]->AddSpacer(15);
addc++;
}
row_sizer[count]->AddSpacer(10);
mainsizer->Add(row_sizer[count]);
count++;
}
mybuild->SetScrollbar(wxHORIZONTAL, wxDEFAULT, 10, 100, true);
mybuild->SetScrollbar(wxVERTICAL, wxDEFAULT, 10, 100, true);
mybuild->SetScrollRate(150, 0);
mybuild->FitInside();
mybuild->SetSizerAndFit(mainsizer);
mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->AddSpacer(7);
mainSizer->Add(mybuild);
wxBoxSizer* lower_sizer = new wxBoxSizer(wxVERTICAL);
wxPanel* panel2 = new wxPanel(panel, wxID_ANY, wxDefaultPosition, wxSize(w, 20), wxTAB_TRAVERSAL);
panel3 = new wxPanel(panel, wxID_ANY, wxDefaultPosition, wxSize(w, 20), wxTAB_TRAVERSAL);
wxBoxSizer* button_sizer2 = new wxBoxSizer(wxHORIZONTAL);
spez_butsizer = new wxBoxSizer(wxHORIZONTAL);
my_abb = new wxButton(panel2, Button_abb_bearb, sp_text[10]);
button_sizer2->Add(my_abb, 0, wxALL, 10);
// my_abb->SetBackgroundColour(wxColour("#ff0000"));
my_uber = new wxButton(panel2, Button_uber_bearb, sp_text[11]);
// button_sizer2->Add(new wxButton(panel2, Button_uber_bearb, sp_text[11]), 0, wxALL, 10);
my_uber->SetBackgroundColour(wxColour("#" + strcolor));
button_sizer2->Add(my_uber, 0, wxALL, 10);
if (ord_wnum == "yes")
{
button_sizer2->Add(new wxButton(panel2, Button_order, sp_text[57]), 0, wxALL, 10);
}
else
{
button_sizer2->Add(new wxButton(panel2, Button_order, sp_text[56]), 0, wxALL, 10);
}
if (nmchan == "yes")
{
my_ver = new wxButton(panel2, Button_mark, sp_text[110]);
}
else
{
my_ver = new wxButton(panel2, Button_mark, sp_text[109]);
}
my_ver->SetBackgroundColour(wxColour("#"+notcolor));
button_sizer2->Add(my_ver, 0, wxALL, 10);
button_sizer2->Add(new wxButton(panel2, Button_clear, sp_text[111]), 0, wxALL, 10);
button_sizer2->Add(new wxButton(panel2, Button_num, sp_text[112]), 0, wxALL, 10);
button_sizer2->Add(new wxButton(panel2, Button_add_but, sp_text[114]), 0, wxALL, 10);
button_sizer2->Add(new wxButton(panel2, Button_cle_but, sp_text[115]), 0, wxALL, 10);
//spez_butsizer->Add(new wxButton(panel3, Button_cle_but, sp_text[115]), 0, wxALL, 10);
lower_sizer->Add(button_sizer2);
// lower_sizer->AddSpacer(7);
// lower_sizer->Add(spez_butsizer);
//lower_sizer->AddStretchSpacer(wxALL);
panel2->SetSizerAndFit(lower_sizer);
panel2->Layout();
spez_butsizer->AddSpacer(7);
panel3->SetSizerAndFit(spez_butsizer);
panel3->Layout();
mainSizer->Add(panel2);
mainSizer->Add(panel3);
mainSizer->SetMinSize(wxSize(w, h));
panel->SetSizer(mainSizer);
panel->SetScrollbar(wxHORIZONTAL, wxDEFAULT, 10, 100, true);
panel->SetScrollbar(wxVERTICAL, wxDEFAULT, 100, 10, true);
panel->SetScrollRate(150, 150);
panel->Layout();
my_abb->SetFocus();
}