endif
WXLIB_LIST = core,base,gl,adv
-OBJECTS = ConsoleFrame.o GlobalParameterFrame.o GlobalParameterFilesFrame.o MoleculeView.o MyApp.o MyCommand.o MyDocument.o MyGLCanvas.o MySlider.o MyClipboardData.o ProgressFrame.o MyListCtrl.o MyDocManager.o wxKillAddition.o RubyDialogFrame.o MyIPCSupport.o MyVersion.o MyThread.o MyProgressIndicator.o modalwindow.o MyTextCtrl.o docview.o
+OBJECTS = ConsoleFrame.o GlobalParameterFrame.o GlobalParameterFilesFrame.o MoleculeView.o MyApp.o MyCommand.o MyDocument.o MyGLCanvas.o MySlider.o MyClipboardData.o ProgressFrame.o MyListCtrl.o MyDocManager.o wxKillAddition.o RubyDialogFrame.o MyIPCSupport.o MyVersion.o MyThread.o MyProgressIndicator.o MyToggleButton.o modalwindow.o MyTextCtrl.o docview.o
LIBS = MolLib.a Ruby_bind.a
RUBY_EXTLIB = scanf.rb
molbyicon ICON "../bitmaps/molby_icon.ico"
+#define wxUSE_DPI_AWARE_MANIFEST 2
#include "wx/msw/wx.rc"
molbyicon ICON "../bitmaps/molby_icon.ico"
+#define wxUSE_DPI_AWARE_MANIFEST 2
#include "wx/msw/wx.rc"
E420BE22188574F600A2B983 /* ProgressFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE1D188574F600A2B983 /* ProgressFrame.cpp */; };
E420BE23188574F600A2B983 /* RubyDialogFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE1F188574F600A2B983 /* RubyDialogFrame.cpp */; };
E420BE24188574F600A2B983 /* wxKillAddition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE21188574F600A2B983 /* wxKillAddition.cpp */; };
+ E4589CEF28D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; };
+ E4589CF028D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; };
E4653CB118A0CC7D0022377B /* textctrl_addition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4653CB018A0CC7D0022377B /* textctrl_addition.mm */; };
E4ACACE718C6D32300F08B67 /* ortep3 in Resources */ = {isa = PBXBuildFile; fileRef = E4ACACE418C6D32300F08B67 /* ortep3 */; };
E4D379A219C87C2200636D28 /* modalwindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D379A119C87C2200636D28 /* modalwindow.cpp */; };
E420BE1F188574F600A2B983 /* RubyDialogFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RubyDialogFrame.cpp; sourceTree = "<group>"; };
E420BE20188574F600A2B983 /* RubyDialogFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RubyDialogFrame.h; sourceTree = "<group>"; };
E420BE21188574F600A2B983 /* wxKillAddition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wxKillAddition.cpp; sourceTree = "<group>"; };
+ E4589CED28D5FD6400F55785 /* MyToggleButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyToggleButton.h; sourceTree = "<group>"; };
+ E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MyToggleButton.cpp; sourceTree = "<group>"; };
E45B94611A170B9A008E95EB /* docview.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = docview.cpp; sourceTree = "<group>"; };
E460B2DC2739716500CD9407 /* Version */ = {isa = PBXFileReference; lastKnownFileType = text; name = Version; path = ../Version; sourceTree = "<group>"; };
E4653CB018A0CC7D0022377B /* textctrl_addition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = textctrl_addition.mm; sourceTree = "<group>"; };
E420BE05188574AD00A2B983 /* MyDocument.h */,
E420BE06188574AD00A2B983 /* MyGLCanvas.cpp */,
E420BE07188574AD00A2B983 /* MyGLCanvas.h */,
+ E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */,
+ E4589CED28D5FD6400F55785 /* MyToggleButton.h */,
E420BE08188574AD00A2B983 /* MyIPCSupport.cpp */,
E420BE09188574AD00A2B983 /* MyIPCSupport.h */,
E420BE0A188574AD00A2B983 /* MyListCtrl_orig.cpp */,
E4FC77BD183E4F3F0064FB2E /* ruby_types.c in Sources */,
E4FC77BE183E4F3F0064FB2E /* Trackball.c in Sources */,
E4FC77BF183E4F3F0064FB2E /* Types.c in Sources */,
+ E4589CEF28D5FD6400F55785 /* MyToggleButton.cpp in Sources */,
E4FC7CA6183F94D30064FB2E /* buildInfo.c in Sources */,
E420BDEF1885746700A2B983 /* ConsoleFrame.cpp in Sources */,
E420BDF11885746700A2B983 /* GlobalParameterFilesFrame.cpp in Sources */,
E4059FB728C46A6E0052B36B /* ConsoleFrame.cpp in Sources */,
E403568628D0B7B0008E2C46 /* MyListCtrl.cpp in Sources */,
E4059FB828C46A6E0052B36B /* filedlg.mm in Sources */,
+ E4589CF028D5FD6400F55785 /* MyToggleButton.cpp in Sources */,
E4059FB928C46A6E0052B36B /* GlobalParameterFilesFrame.cpp in Sources */,
E4059FBA28C46A6E0052B36B /* GlobalParameterFrame.cpp in Sources */,
E4059FBC28C46A6E0052B36B /* MoleculeView.cpp in Sources */,
ConsoleFrame *frame = new ConsoleFrame(parent, _T("Molby Console"), origin, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
frame->OnCreate();
- frame->SetClientSize(size);
+ frame->SetClientSize(FromFrameDIP(frame, size));
return frame;
}
wxBoxSizer *sizer0;
sizer0 = new wxBoxSizer(wxVERTICAL);
listctrl = new MyListCtrl();
- listctrl->Create(this, wxID_ANY, wxDefaultPosition, size);
- listctrl->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 80);
- listctrl->InsertColumn(1, _T("directory"), wxLIST_FORMAT_LEFT, 240);
+ listctrl->Create(this, wxID_ANY, wxDefaultPosition, FromFrameDIP(this, size));
+ listctrl->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, FromFrameDIP(this, 80));
+ listctrl->InsertColumn(1, _T("directory"), wxLIST_FORMAT_LEFT, FromFrameDIP(this, 240));
sizer0->Add(listctrl, 1, wxLEFT | wxRIGHT | wxEXPAND, 0);
{
wxBoxSizer *sizer1;
wxSize size(700, 240);
#endif
- GlobalParameterFilesFrame *frame = new GlobalParameterFilesFrame(parent, _T("Load/Unload Global Parameters"), origin, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
+ GlobalParameterFilesFrame *frame = new GlobalParameterFilesFrame(parent, _T("Load/Unload Global Parameters"), FromFrameDIP(parent, origin), FromFrameDIP(parent, size), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
frame->OnCreate();
return frame;
wxPoint origin(26, 40);
wxSize size(774, 300);
#endif
- GlobalParameterFrame *frame = new GlobalParameterFrame(parent, _T("Global Parameters"), origin, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
+ GlobalParameterFrame *frame = new GlobalParameterFrame(parent, _T("Global Parameters"), FromFrameDIP(parent, origin), FromFrameDIP(parent, size), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
frame->OnCreate();
return frame;
// Make a document frame
frame = new wxDocChildFrame(doc, this, GetMainFrame(), wxID_ANY, _T("New Molby Document"),
- wxPoint(10, 24), wxSize(680, 400),
+ wxDefaultPosition, wxDefaultSize,
wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE);
-
+ frame->SetPosition(FromFrameDIP(frame, wxPoint(10, 24)));
+ frame->SetClientSize(FromFrameDIP(frame, wxSize(680, 400)));
canvas = NULL;
mview = NULL;
listmenu = NULL;
myID_SelectButton, myID_BondButton, myID_EraseButton
};
for (i = 0; i < 6; i++) {
- tbuttons[i] = new wxToggleButton(panel1, ids[i], labels[i], wxDefaultPosition, wxSize(40, 32), wxTOGGLEBUTTON_STYLE);
+ tbuttons[i] = new MyToggleButton(panel1, ids[i], labels[i], wxDefaultPosition, FromFrameDIP(frame, wxSize(40, 32)), wxTOGGLEBUTTON_STYLE);
if (ctrlFont)
tbuttons[i]->SetFont(*ctrlFont);
- sizer2->Add(tbuttons[i], 0, wxALL | wxEXPAND, 3);
+ sizer2->Add(tbuttons[i], 0, wxALL | wxEXPAND, FromFrameDIP(frame, 3));
}
tbuttons[0]->SetValue(true);
}
{ // Information text
- infotext = new wxStaticText(panel1, -1, wxT(""), wxDefaultPosition, wxSize(80, 32), wxST_NO_AUTORESIZE | wxBORDER_SUNKEN);
- infotext->SetMinSize(wxSize(80, 32));
+ infotext = new wxStaticText(panel1, -1, wxT(""), wxDefaultPosition, FromFrameDIP(frame, wxSize(80, 32)), wxST_NO_AUTORESIZE | wxBORDER_SUNKEN);
+ infotext->SetMinSize(FromFrameDIP(frame, wxSize(80, 32)));
#if defined(__WXMSW__)
infotext->SetFont(*wxSMALL_FONT);
#else
sizer2->Add(infotext, 1, wxALL | wxEXPAND, 3); // Can expand horizontally
}
{ // Custom progress indicator
- progress = new MyProgressIndicator(panel1, myID_StopProgressButton, wxDefaultPosition, wxSize(12, 24));
+ progress = new MyProgressIndicator(panel1, myID_StopProgressButton, wxDefaultPosition, FromFrameDIP(frame, wxSize(12, 24)));
sizer2->Add(progress, 0, wxALL | wxEXPAND, 3);
}
sizer1->Add(sizer2, 0, wxALL | wxEXPAND, 0);
{ // Vertical sizer containing [Canvas, [button, mySlider]]
wxBoxSizer *sizer32 = new wxBoxSizer(wxVERTICAL);
{
- canvas = new MyGLCanvas(this, panel1, wxDefaultPosition, wxSize(100, 100));
+ canvas = new MyGLCanvas(this, panel1, wxDefaultPosition, FromFrameDIP(frame, wxSize(100, 100)));
sizer32->Add(canvas, 1, wxALL | wxEXPAND, 0);
// Let the MyGLCanvas pass the keyboard event to this
{
#include "../bitmaps/rotate_y.xpm"
wxBitmap bmp2(rotate_y_xpm);
- wxBitmapButton *button2 = new wxBitmapButton(panel1, -1, bmp2, wxDefaultPosition, wxSize(21, 21), wxTOGGLEBUTTON_STYLE);
+ wxBitmapButton *button2 = new wxBitmapButton(panel1, -1, bmp2, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)), wxTOGGLEBUTTON_STYLE);
sizer321->Add(button2, 0, 0, 0);
button2->Disable();
- MySlider *slider2 = new MySlider(panel1, myID_RotateYSlider, wxHORIZONTAL, wxDefaultPosition, wxSize(21, 21));
+ MySlider *slider2 = new MySlider(panel1, myID_RotateYSlider, wxHORIZONTAL, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)));
sizer321->Add(slider2, 1, wxEXPAND);
}
sizer32->Add(sizer321, 0, wxEXPAND);
{ // "Rotate bond" button and mySlider
#include "../bitmaps/rotate_x.xpm"
wxBitmap bmp3(rotate_x_xpm);
- wxBitmapButton *button3 = new wxBitmapButton(panel1, -1, bmp3, wxDefaultPosition, wxSize(21, 21), wxTOGGLEBUTTON_STYLE);
+ wxBitmapButton *button3 = new wxBitmapButton(panel1, -1, bmp3, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)), wxTOGGLEBUTTON_STYLE);
button3->Disable();
sizer33->Add(button3, 0, 0, 0);
- MySlider *slider3 = new MySlider(panel1, myID_RotateXSlider, wxVERTICAL, wxDefaultPosition, wxSize(21, 21));
+ MySlider *slider3 = new MySlider(panel1, myID_RotateXSlider, wxVERTICAL, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)));
sizer33->Add(slider3, 1, wxEXPAND);
}
sizer3->Add(sizer33, 0, wxALL | wxEXPAND, 0);
{ // Horizontal sizer containing frame controls
const int height = 18;
- frameControlPanel = new wxPanel(panel1, myID_FrameControlPanel, wxDefaultPosition, wxSize(200, height));
+ frameControlPanel = new wxPanel(panel1, myID_FrameControlPanel, wxDefaultPosition, FromFrameDIP(frame, wxSize(200, height)));
wxBoxSizer *sizer4 = new wxBoxSizer(wxHORIZONTAL);
{
- frameSlider = new wxSlider(frameControlPanel, myID_FrameSlider, 0, 0, 1, wxDefaultPosition, wxSize(40, height - 2));
+ frameSlider = new wxSlider(frameControlPanel, myID_FrameSlider, 0, 0, 1, wxDefaultPosition, FromFrameDIP(frame, wxSize(40, height - 2)));
frameSlider->Enable(false);
sizer4->Add(frameSlider, 1, wxALL | wxEXPAND, 1);
#include "../bitmaps/jump_to_start.xpm"
wxBitmap bmp41(jump_to_start_xpm);
- wxBitmapButton *button41 = new wxBitmapButton(frameControlPanel, myID_JumpToStartButton, bmp41, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
+ wxBitmapButton *button41 = new wxBitmapButton(frameControlPanel, myID_JumpToStartButton, bmp41, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
sizer4->Add(button41, 0, wxEXPAND);
ConnectMouseDownEvents(button41, MoleculeView::OnFrameButtonAction, this);
#include "../bitmaps/play_backward.xpm"
wxBitmap bmp42(play_backward_xpm);
- wxBitmapButton *button42 = new wxBitmapButton(frameControlPanel, myID_PlayBackwardButton, bmp42, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
+ wxBitmapButton *button42 = new wxBitmapButton(frameControlPanel, myID_PlayBackwardButton, bmp42, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
sizer4->Add(button42, 0, wxEXPAND);
ConnectMouseDownEvents(button42, MoleculeView::OnFrameButtonAction, this);
{
- frameText = new wxTextCtrl(frameControlPanel, myID_FrameText, wxT(""), wxDefaultPosition, wxSize(40, height));
+ frameText = new wxTextCtrl(frameControlPanel, myID_FrameText, wxT(""), wxDefaultPosition, FromFrameDIP(frame, wxSize(40, height)));
if (ctrlFont) {
wxTextAttr attr(*wxBLACK, wxNullColour, *ctrlFont);
frameText->SetDefaultStyle(attr);
#include "../bitmaps/play_forward.xpm"
wxBitmap bmp43(play_forward_xpm);
- wxBitmapButton *button43 = new wxBitmapButton(frameControlPanel, myID_PlayForwardButton, bmp43, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
+ wxBitmapButton *button43 = new wxBitmapButton(frameControlPanel, myID_PlayForwardButton, bmp43, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
sizer4->Add(button43, 0, wxEXPAND);
ConnectMouseDownEvents(button43, MoleculeView::OnFrameButtonAction, this);
#include "../bitmaps/jump_to_end.xpm"
wxBitmap bmp44(jump_to_end_xpm);
- wxBitmapButton *button44 = new wxBitmapButton(frameControlPanel, myID_JumpToEndButton, bmp44, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
+ wxBitmapButton *button44 = new wxBitmapButton(frameControlPanel, myID_JumpToEndButton, bmp44, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
sizer4->Add(button44, 0, wxEXPAND);
ConnectMouseDownEvents(button44, MoleculeView::OnFrameButtonAction, this);
- wxPanel *spacer = new wxPanel(frameControlPanel, -1, wxDefaultPosition, wxSize(21, height));
+ wxPanel *spacer = new wxPanel(frameControlPanel, -1, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, height)));
sizer4->Add(spacer, 0, wxEXPAND);
}
frameControlPanel->SetSizer(sizer4);
frame->SetSizer(mainsizer);
mainsizer->Layout();
- splitter->SetSashPosition(240, true);
+ splitter->SetSashPosition(FromFrameDIP(frame, 240), true);
// Initialize table view
MainView_createColumnsForTableAtIndex(mview, 0);
return 0;
idx = listctrl->GetColumnCount();
listctrl->InsertColumn(idx, nstr, wxLIST_FORMAT_LEFT);
- listctrl->SetColumnWidth(idx, width * 10);
+ listctrl->SetColumnWidth(idx, FromFrameDIP(listctrl, width * 10));
return idx;
}
#include "../MolLib/MolLib.h"
#include "MyListCtrl.h"
+#include "MyToggleButton.h"
class MyDocument;
class MyGLCanvas;
class wxMenu;
-class wxToggleButton;
class wxStaticText;
class wxChoice;
class MyProgressIndicator;
MyListCtrl *listctrl;
wxMenu *file_history_menu;
wxMenu *edit_menu;
- wxToggleButton *tbuttons[6];
+ MyToggleButton *tbuttons[6];
wxStaticText *infotext;
MyProgressIndicator *progress;
wxPanel *frameControlPanel;
MyDocument *MolDocument() { return (MyDocument *)m_viewDocument; }
MyListCtrl *GetListCtrl() { return listctrl; }
- wxToggleButton *GetToggleButtonAtIndex(int i) { return (i >= 0 && i < 6 ? tbuttons[i] : NULL); }
+ MyToggleButton *GetToggleButtonAtIndex(int i) { return (i >= 0 && i < 6 ? tbuttons[i] : NULL); }
bool OnCreate(wxDocument *doc, long flags);
void OnDraw(wxDC *dc);
// Create the main frame window
frame = new MyFrame((wxDocManager *) m_docManager, (wxFrame *) NULL,
- _T("Molby"), wxPoint(0, 0), wxSize(800, 600),
+ _T("Molby"), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
+ frame->SetClientSize(FromFrameDIP(frame, wxSize(800, 600)));
// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
free(s2);
free(s3);
#if defined(__WXMSW__)
- wxFont *textFont0 = new wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
- wxFont *textFont1 = new wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
- wxFont *textFont2 = new wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+ wxFont *textFont0 = new wxFont(FromFrameDIP(this, 12), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
+ wxFont *textFont1 = new wxFont(FromFrameDIP(this, 10), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+ wxFont *textFont2 = new wxFont(FromFrameDIP(this, 9), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
#else
- wxFont *textFont0 = new wxFont(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
- wxFont *textFont1 = new wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
- wxFont *textFont2 = new wxFont(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+ wxFont *textFont0 = new wxFont(FromFrameDIP(this, 14), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
+ wxFont *textFont1 = new wxFont(FromFrameDIP(this, 12), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+ wxFont *textFont2 = new wxFont(FromFrameDIP(this, 11), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
#endif
wxBoxSizer *vsizer1 = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *vsizer2 = new wxBoxSizer(wxVERTICAL);
wxStaticText *stext2 = new wxStaticText(this, -1, str2);
stext2->SetFont(*textFont1);
wxStaticBitmap *staticBitmap = new wxStaticBitmap(this, -1, *molbyBitmap);
- vsizer2->Add(stext1, 0, wxALL | wxEXPAND, 2);
- vsizer2->Add(stext2, 0, wxALL | wxEXPAND, 2);
- hsizer1->AddSpacer(20);
- hsizer1->Add(staticBitmap, 0, 0, 10);
- hsizer1->AddSpacer(20);
- hsizer1->Add(vsizer2, 0, wxALL | wxEXPAND, 5);
+ vsizer2->Add(stext1, 0, wxALL | wxEXPAND, FromFrameDIP(this, 2));
+ vsizer2->Add(stext2, 0, wxALL | wxEXPAND, FromFrameDIP(this, 2));
+ hsizer1->AddSpacer(FromFrameDIP(this, 20));
+ hsizer1->Add(staticBitmap, 0, 0, FromFrameDIP(this, 10));
+ hsizer1->AddSpacer(FromFrameDIP(this, 20));
+ hsizer1->Add(vsizer2, 0, wxALL | wxEXPAND, FromFrameDIP(this, 5));
wxStaticText *stext3 = new wxStaticText(this, -1, str3);
stext3->SetFont(*textFont2);
- vsizer1->Add(hsizer1, 0, wxALL | wxEXPAND, 5);
- vsizer1->Add(stext3, 0, wxALL | wxEXPAND, 5);
- vsizer1->Add(this->CreateButtonSizer(wxOK), 0, wxALL | wxEXPAND, 10);
+ vsizer1->Add(hsizer1, 0, wxALL | wxEXPAND, FromFrameDIP(this, 5));
+ vsizer1->Add(stext3, 0, wxALL | wxEXPAND, FromFrameDIP(this, 5));
+ vsizer1->Add(this->CreateButtonSizer(wxOK), 0, wxALL | wxEXPAND, FromFrameDIP(this, 10));
vsizer1->Layout();
this->SetSizerAndFit(vsizer1);
this->Centre();
{ // Vertical sizer containing [prompt, textbox, buttons]
wxBoxSizer *sizer1;
sizer1 = new wxBoxSizer(wxVERTICAL);
- stext = new wxStaticText(dialog, -1, pstr, wxDefaultPosition, wxSize(200, 22));
- sizer1->Add(stext, 0, wxEXPAND | wxALL, 6);
- tctrl = new wxTextCtrl(dialog, -1, defstr, wxDefaultPosition, wxSize(200, 22));
- sizer1->Add(tctrl, 0, wxEXPAND | wxALL, 6);
+ stext = new wxStaticText(dialog, -1, pstr, wxDefaultPosition, FromFrameDIP(dialog, wxSize(200, 22)));
+ sizer1->Add(stext, 0, wxEXPAND | wxALL, FromFrameDIP(dialog, 6));
+ tctrl = new wxTextCtrl(dialog, -1, defstr, wxDefaultPosition, FromFrameDIP(dialog, wxSize(200, 22)));
+ sizer1->Add(tctrl, 0, wxEXPAND | wxALL, FromFrameDIP(dialog, 6));
wxSizer *bsizer = dialog->CreateButtonSizer(wxOK | wxCANCEL);
- sizer1->Add(bsizer, 0, wxEXPAND | wxALL, 6);
+ sizer1->Add(bsizer, 0, wxEXPAND | wxALL, FromFrameDIP(dialog, 6));
sizer1->Layout();
dialog->SetSizerAndFit(sizer1);
dialog->Centre(wxBOTH);
#define wxTOGGLEBUTTON_STYLE 0
#endif
+#if wxCHECK_VERSION(3,1,0)
+#define FromFrameDIP(frame, x) frame->FromDIP(x)
+#define ToFrameDIP(frame, x) frame->ToDIP(x)
+#else
+#define FromFrameDIP(frame, x) (x)
+#define ToFrameDIP(frame, x) (x)
+#endif
+
+#define FromDCDIP FromFrameDIP
+#define ToDCDIP ToFrameDIP
+
enum {
myMenuID_MyFirstMenuItem = 12000,
myMenuID_Import = 12001,
#include "wx/menu.h"
#include "wx/sizer.h"
+#if wxCHECK_VERSION(3,1,0)
+#define FromFrameDIP(frame, x) frame->FromDIP(x)
+#else
+#define FromFrameDIP(frame, x) (x)
+#endif
+
const wxEventType MyListCtrlEvent = wxNewEventType();
IMPLEMENT_DYNAMIC_CLASS(MyListCtrl, wxWindow)
header = new wxWindow(this, 1001, wxPoint(0, 0), wxSize(size.x, 16));
scroll = new wxScrolledWindow(this, 1002, wxPoint(0, 16), wxSize(size.x, (size.y <= 16 ? -1 : size.y - 16)));
- // Set sizer
- wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
- vsizer->Add(header, wxSizerFlags(0).Expand().Border(wxALL, 0));
- vsizer->Add(scroll, wxSizerFlags(1).Expand().Border(wxALL, 0));
- this->SetSizer(vsizer);
-
// Connect events
header->Bind(wxEVT_PAINT, &MyListCtrl::OnPaintHeader, this);
scroll->Bind(wxEVT_PAINT, &MyListCtrl::OnPaint, this);
rowHeight = h + 2;
dc.GetTextExtent(_T("M"), &w, &h, &descent, &leading, &headerFont);
headerHeight = h + 2;
+ header->SetSize(wxSize(size.x, headerHeight));
}
+
+ // Set sizer
+ wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
+ vsizer->Add(header, wxSizerFlags(0).Expand().Border(wxALL, 0));
+ vsizer->Add(scroll, wxSizerFlags(1).Expand().Border(wxALL, 0));
+ this->SetSizer(vsizer);
selectionChangeNotificationRequired = false;
selectionChangeNotificationEnabled = true;
}
// rowHeight = dataSource->GetRowHeight(this);
// "+4" is for drawing marker during cell dragging
- pageHeight = rowHeight * nrows + 4;
+ pageHeight = rowHeight * nrows + FromFrameDIP(this, 4);
// Set the subwindow infos
sz.y = headerHeight;
header->SetMinSize(sz);
wxTextAttr attr;
wxString str;
int x, y;
+ int mg = FromFrameDIP(this, 2);
row = floor(oy / rowHeight);
for (j = row; j < nrows; j++) {
float fg0[4], bg0[4];
if (i == ncols - 1) {
dc.DrawLine(x + colWidths[i], y, x + colWidths[i], y + rowHeight - 1);
}
- dc.SetClippingRegion(x + 2, y, colWidths[i] - 4, rowHeight - 1);
- dc.DrawText(str, x + 2, y);
+ dc.SetClippingRegion(x + mg, y, colWidths[i] - mg * 2, rowHeight - 1);
+ dc.DrawText(str, x + mg, y);
dc.DestroyClippingRegion();
x += colWidths[i];
if (x > ox + sz.x)
int x, x1;
int i;
wxTextAttr attr;
+ int mg = FromFrameDIP(this, 2);
scroll->CalcUnscrolledPosition(0, 0, &ox, &oy);
x = -ox;
for (i = 0; i < ncols; i++) {
if (x1 > 0) {
wxString str = colNames[i];
dc.DrawLine(x + colWidths[i], 0, x + colWidths[i], sz.y - 1);
- dc.SetClippingRegion(x + 2, 0, colWidths[i] - 4, sz.y);
- dc.DrawText(str, x + 2, 0);
+ dc.SetClippingRegion(x + mg, 0, colWidths[i] - mg * 2, sz.y);
+ dc.DrawText(str, x + mg, 0);
dc.DestroyClippingRegion();
}
x = x1;
--- /dev/null
+/*
+ * MyToggleButton
+ * Molby
+ *
+ * Created by Toshi Nagata on 2022/09/17.
+ * Copyright 2022 Toshi Nagata. All rights reserved.
+ *
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ */
+
+#include "MyToggleButton.h"
+#include "wx/dcclient.h"
+
+IMPLEMENT_DYNAMIC_CLASS(MyToggleButton, wxToggleButton)
+
+BEGIN_EVENT_TABLE(MyToggleButton, wxToggleButton)
+EVT_PAINT(MyToggleButton::OnPaint)
+EVT_LEFT_DOWN(MyToggleButton::OnLeftDown)
+EVT_LEFT_UP(MyToggleButton::OnLeftUp)
+END_EVENT_TABLE()
+
+void
+MyToggleButton::OnPaint(wxPaintEvent &event)
+{
+ wxPaintDC dc(this);
+ wxSize size = GetSize();
+ dc.SetPen(*wxGREY_PEN);
+ const wxBrush *brush;
+ if (IsPressed())
+ brush = wxTheBrushList->FindOrCreateBrush(wxColour(128, 128, 128));
+ else if (GetValue())
+ brush = wxTheBrushList->FindOrCreateBrush(wxColour(180, 180, 180));
+ else
+ brush = wxTheBrushList->FindOrCreateBrush(wxColour(240, 240, 240));
+ dc.SetBrush(*brush);
+ dc.DrawRectangle(0, 0, size.x, size.y);
+ wxString label = GetLabel();
+ int w, h, descent;
+ int x, y;
+ dc.GetTextExtent(label, &w, &h, &descent);
+ x = (size.x - w) / 2;
+ y = (size.y - h) / 2;
+ dc.SetPen(*wxBLACK_PEN);
+ dc.DrawText(label, x, y);
+}
+
+void
+MyToggleButton::OnLeftDown(wxMouseEvent &event)
+{
+ CaptureMouse();
+ SetPressed(true);
+ Refresh();
+}
+
+void
+MyToggleButton::OnLeftUp(wxMouseEvent &event)
+{
+ ReleaseMouse();
+ SetPressed(false);
+ int x = event.GetX();
+ int y = event.GetY();
+ wxSize sz = GetSize();
+ if (x > 0 && x < sz.x && y > 0 && y < sz.y) {
+ SetValue(!GetValue());
+ wxCommandEvent cmdevt(wxEVT_TOGGLEBUTTON, GetId());
+ cmdevt.SetInt(GetValue());
+ cmdevt.SetEventObject(this);
+ ProcessCommand(cmdevt);
+ Refresh();
+ }
+}
--- /dev/null
+/*
+ * MyToggleButton.h
+ * Molby
+ *
+ * Created by Toshi Nagata on 2022/09/17.
+ * Copyright 2022 Toshi Nagata. All rights reserved.
+ *
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ */
+
+#ifndef __MyToggleButton_h__
+#define __MyToggleButton_h__
+
+#include "wx/tglbtn.h"
+
+class MyToggleButton: public wxToggleButton
+{
+public:
+ MyToggleButton() {}
+ MyToggleButton (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &val=wxDefaultValidator, const wxString &name=wxCheckBoxNameStr)
+ : wxToggleButton(parent, id, label, pos, size, style, val, name) {
+ m_isPressed = m_value = false;
+ }
+
+ void OnPaint(wxPaintEvent &event);
+ void OnLeftDown(wxMouseEvent &event);
+ void OnLeftUp(wxMouseEvent &event);
+ void SetValue(bool val) { m_value = val; Refresh(); }
+ bool GetValue() { return m_value; }
+ void SetPressed(bool flag) { m_isPressed = flag; Refresh(); }
+ bool IsPressed() { return m_isPressed; }
+
+private:
+ bool m_isPressed;
+ bool m_value;
+ bool m_isEnabled;
+ DECLARE_DYNAMIC_CLASS(MyToggleButton)
+ DECLARE_EVENT_TABLE()
+};
+
+
+#endif /* __MyToggleButton_h__ */
+
buttonSizer = NULL; // Will be created later
myTimer = NULL; // Will be created when necessary
boxSizer = new wxBoxSizer(wxVERTICAL);
- boxSizer->Add(contentSizer, 1, wxALL | wxEXPAND, 14);
+ boxSizer->Add(contentSizer, 1, wxALL | wxEXPAND, FromFrameDIP(this, 14));
this->SetSizer(boxSizer);
boxSizer->Layout();
}
if (sizer == NULL)
return; /* Cannot create */
if (buttonSizer == NULL) {
- boxSizer->Add(sizer, 0, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, 14);
+ boxSizer->Add(sizer, 0, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, FromFrameDIP(this, 14));
buttonSizer = sizer;
} else {
boxSizer->Replace(buttonSizer, sizer);
RDSize
RubyDialogCallback_windowMinSize(RubyDialog *dref)
{
- wxSize minSize = ((RubyDialogFrame *)dref)->GetMinSize();
+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
+ wxSize minSize = ToFrameDIP(dframe, dframe->GetMinSize());
RDSize rminSize;
rminSize.width = minSize.GetWidth();
rminSize.height = minSize.GetHeight();
void
RubyDialogCallback_setWindowMinSize(RubyDialog *dref, RDSize size)
{
+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
wxSize minSize;
minSize.x = (int)size.width;
minSize.y = (int)size.height;
- ((RubyDialogFrame *)dref)->SetMinSize(minSize);
+ dframe->SetMinSize(FromFrameDIP(dframe, minSize));
}
RDSize
RubyDialogCallback_windowSize(RubyDialog *dref)
{
- wxSize minSize = ((RubyDialogFrame *)dref)->GetSize();
+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
+ wxSize minSize = ToFrameDIP(dframe, dframe->GetSize());
RDSize rminSize;
rminSize.width = minSize.GetWidth();
rminSize.height = minSize.GetHeight();
void
RubyDialogCallback_setWindowSize(RubyDialog *dref, RDSize size)
{
+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
wxSize wsize((int)size.width, (int)size.height);
- ((RubyDialogFrame *)dref)->SetSize(wsize);
- ((RubyDialogFrame *)dref)->CentreOnScreen();
+ dframe->SetSize(FromFrameDIP(dframe, wsize));
+ dframe->CentreOnScreen();
}
void
rect.SetPosition(wxDefaultPosition);
rect.SetSize(wxDefaultSize);
} else {
- rect.SetX(rect.x + offset.x);
- rect.SetY(rect.y + offset.y);
- rect.SetWidth(rect.width + offset.width);
- rect.SetHeight(rect.height + offset.height);
+ rect.SetX(FromFrameDIP(parent, rect.x + offset.x));
+ rect.SetY(FromFrameDIP(parent, rect.y + offset.y));
+ rect.SetWidth(FromFrameDIP(parent, rect.width + offset.width));
+ rect.SetHeight(FromFrameDIP(parent, rect.height + offset.height));
}
if (strcmp(type, "text") == 0) {
if (title[0] != 0 || strcmp(type, "textfield") == 0) {
/* Resize the frame rect as necessary */
RDSize minSize = RubyDialogCallback_sizeOfString((RDItem *)control, title);
- wxSize size = control->GetSize();
+ wxSize size = ToFrameDIP(parent, control->GetSize());
if (size.GetHeight() < minSize.height)
size.SetHeight(minSize.height);
if (size.GetWidth() < minSize.width)
size.SetWidth(minSize.width);
size.SetWidth(size.GetWidth() + offset.width);
size.SetHeight(size.GetHeight() + offset.height);
- control->SetSize(size);
+ control->SetSize(FromFrameDIP(parent, size));
}
if (wxDynamicCast(control, wxTextCtrl) != NULL) {
void
RubyDialogCallback_moveItemUnderView(RDItem *item, RDItem *superView, RDPoint origin)
{
+ wxWindow *sv = (wxWindow *)superView;
if (item == NULL || superView == NULL || item == superView)
return;
- if (((wxWindow *)item)->Reparent((wxWindow *)superView)) {
- ((wxWindow *)item)->Move(origin.x, origin.y);
+ if (((wxWindow *)item)->Reparent(sv)) {
+ ((wxWindow *)item)->Move(FromFrameDIP(sv, origin.x), FromFrameDIP(sv, origin.y));
}
}
RDRect
RubyDialogCallback_frameOfItem(RDItem *item)
{
- wxRect rect = ((wxWindow *)item)->GetRect();
+ wxWindow *wp = (wxWindow *)item;
+ wxRect rect = wp->GetRect();
if (gRubyDialogIsFlipped) {
- wxWindow *parent = ((wxWindow *)item)->GetParent();
+ wxWindow *parent = wp->GetParent();
if (parent != NULL) {
wxRect superRect = parent->GetRect();
rect.SetY(superRect.GetHeight() - rect.GetHeight() - rect.GetY());
}
}
+ rect.x = ToFrameDIP(wp, rect.x);
+ rect.y = ToFrameDIP(wp, rect.y);
+ rect.width = ToFrameDIP(wp, rect.width);
+ rect.height = ToFrameDIP(wp, rect.height);
return RDRectFromwxRect(rect);
}
void
RubyDialogCallback_setFrameOfItem(RDItem *item, RDRect rect)
{
+ wxWindow *wp = (wxWindow *)item;
wxRect wrect = wxRectFromRDRect(rect);
if (gRubyDialogIsFlipped) {
- wxWindow *parent = ((wxWindow *)item)->GetParent();
+ wxWindow *parent = wp->GetParent();
if (parent != NULL) {
wxRect srect = parent->GetRect();
wrect.SetY(srect.GetHeight() - wrect.GetHeight() - wrect.GetY());
}
}
- ((wxWindow *)item)->SetSize(wrect);
+ wrect.x = FromFrameDIP(wp, wrect.x);
+ wrect.y = FromFrameDIP(wp, wrect.y);
+ wrect.width = FromFrameDIP(wp, wrect.width);
+ wrect.height = FromFrameDIP(wp, wrect.height);
+ wp->SetSize(wrect);
}
void
}
if (textctrl != NULL) {
wxTextAttr newAttr;
- wxFont newFont(size, family, style, weight);
+ wxFont newFont(FromFrameDIP(textctrl, size), family, style, weight);
newAttr.SetFont(newFont);
textctrl->SetDefaultStyle(newAttr);
#if __WXMAC__
textctrl->SetFont(newFont);
#endif
} else {
- ctrl->SetFont(wxFont(size, family, style, weight));
+ ctrl->SetFont(wxFont(FromFrameDIP(ctrl, size), family, style, weight));
wxString label = ctrl->GetLabel();
ctrl->SetLabel(_(""));
ctrl->SetLabel(label); /* Update the control size */
wxTextAttr attr = ctrl->GetDefaultStyle();
wxFont font = attr.GetFont();
if (size != NULL)
- *size = font.GetPointSize();
+ *size = ToFrameDIP(ctrl, font.GetPointSize());
if (family != NULL) {
n = font.GetFamily();
*family = (n == wxFONTFAMILY_DEFAULT ? 1 :
break;
s1 = s2 + 1;
}
+ size.width = ToFrameDIP(((wxWindow *)item), size.width);
+ size.height = ToFrameDIP(((wxWindow *)item), size.height);
return size;
}
RDSize rsize;
size = ((wxWindow *)item)->GetBestSize();
((wxWindow *)item)->SetSize(size);
- rsize.width = size.GetWidth();
- rsize.height = size.GetHeight();
+ rsize.width = ToFrameDIP(((wxWindow *)item), size.GetWidth());
+ rsize.height = ToFrameDIP(((wxWindow *)item), size.GetHeight());
return rsize;
}
wxDC *dcp = (wxDC *)dc;
if (dcp == NULL)
return;
- dcp->DrawEllipse(x - r1, y - r2, r1 * 2, r2 * 2);
+ dcp->DrawEllipse(FromDCDIP(dcp, x - r1), FromDCDIP(dcp, y - r2), FromDCDIP(dcp, r1 * 2), FromDCDIP(dcp, r2 * 2));
}
void
wxPoint *pts = new wxPoint[ncoords];
int i;
for (i = 0; i < ncoords; i++) {
- pts[i].x = (int)coords[i * 2];
- pts[i].y = (int)coords[i * 2 + 1];
+ pts[i].x = FromDCDIP(dcp, (int)coords[i * 2]);
+ pts[i].y = FromDCDIP(dcp, (int)coords[i * 2 + 1]);
}
dcp->DrawLines(ncoords, pts);
delete [] pts;
if (dcp == NULL)
return;
if (round > 0.0)
- dcp->DrawRoundedRectangle((int)x, (int)y, (int)width, (int)height, (int)round);
+ dcp->DrawRoundedRectangle(FromDCDIP(dcp, x), FromDCDIP(dcp, y), FromDCDIP(dcp, width), FromDCDIP(dcp, height), FromDCDIP(dcp, round));
else
- dcp->DrawRectangle((int)x, (int)y, (int)width, (int)height);
+ dcp->DrawRectangle(FromDCDIP(dcp, x), FromDCDIP(dcp, y), FromDCDIP(dcp, width), FromDCDIP(dcp, height));
}
void
if (dcp == NULL)
return;
wxString str(s, WX_DEFAULT_CONV);
- dcp->DrawText(str, (int)x, (int)y);
+ dcp->DrawText(str, FromDCDIP(dcp, x), FromDCDIP(dcp, y));
}
void
wxFont font = dcp->GetFont();
for (i = 0; args[i] != NULL; i += 2) {
if (strcmp((const char *)args[i], "size") == 0) {
- float size = *((float *)(args[i + 1]));
+ float size = FromDCDIP(dcp, *((float *)(args[i + 1])));
font.SetPointSize((int)size);
} else if (strcmp((const char *)args[i], "style") == 0) {
long style = (intptr_t)(args[i + 1]);
wxColour col((int)(fp[0] * 255.0), (int)(fp[1] * 255.0), (int)(fp[2] * 255.0), (int)(fp[3] * 255.0));
pen.SetColour(col);
} else if (strcmp((const char *)args[i], "width") == 0) {
- float width = *((float *)(args[i + 1]));
+ float width = FromDCDIP(dcp, *((float *)(args[i + 1])));
pen.SetWidth((int)width);
} else if (strcmp((const char *)args[i], "style") == 0) {
long style = (intptr_t)(args[i + 1]);