• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョン3ce19c39aec78f9dfd9d4b555974619bd9647c15 (tree)
日時2022-09-17 23:59:08
作者Toshi Nagata <alchemist.2005@nift...>
コミッターToshi Nagata

ログメッセージ

Win: high resolution display is implemented

変更サマリ

差分

--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ ifeq ($(TARGET_PLATFORM),MSW)
3939 endif
4040
4141 WXLIB_LIST = core,base,gl,adv
42-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
42+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
4343 LIBS = MolLib.a Ruby_bind.a
4444 RUBY_EXTLIB = scanf.rb
4545
--- a/build-win/molby.rc
+++ b/build-win/molby.rc
@@ -1,2 +1,3 @@
11 molbyicon ICON "../bitmaps/molby_icon.ico"
2+#define wxUSE_DPI_AWARE_MANIFEST 2
23 #include "wx/msw/wx.rc"
--- a/build-win32/molby.rc
+++ b/build-win32/molby.rc
@@ -1,2 +1,3 @@
11 molbyicon ICON "../bitmaps/molby_icon.ico"
2+#define wxUSE_DPI_AWARE_MANIFEST 2
23 #include "wx/msw/wx.rc"
--- a/build-xcode/Molby.xcodeproj/project.pbxproj
+++ b/build-xcode/Molby.xcodeproj/project.pbxproj
@@ -112,6 +112,8 @@
112112 E420BE22188574F600A2B983 /* ProgressFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE1D188574F600A2B983 /* ProgressFrame.cpp */; };
113113 E420BE23188574F600A2B983 /* RubyDialogFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE1F188574F600A2B983 /* RubyDialogFrame.cpp */; };
114114 E420BE24188574F600A2B983 /* wxKillAddition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E420BE21188574F600A2B983 /* wxKillAddition.cpp */; };
115+ E4589CEF28D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; };
116+ E4589CF028D5FD6400F55785 /* MyToggleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */; };
115117 E4653CB118A0CC7D0022377B /* textctrl_addition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4653CB018A0CC7D0022377B /* textctrl_addition.mm */; };
116118 E4ACACE718C6D32300F08B67 /* ortep3 in Resources */ = {isa = PBXBuildFile; fileRef = E4ACACE418C6D32300F08B67 /* ortep3 */; };
117119 E4D379A219C87C2200636D28 /* modalwindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4D379A119C87C2200636D28 /* modalwindow.cpp */; };
@@ -230,6 +232,8 @@
230232 E420BE1F188574F600A2B983 /* RubyDialogFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RubyDialogFrame.cpp; sourceTree = "<group>"; };
231233 E420BE20188574F600A2B983 /* RubyDialogFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RubyDialogFrame.h; sourceTree = "<group>"; };
232234 E420BE21188574F600A2B983 /* wxKillAddition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wxKillAddition.cpp; sourceTree = "<group>"; };
235+ E4589CED28D5FD6400F55785 /* MyToggleButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyToggleButton.h; sourceTree = "<group>"; };
236+ E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MyToggleButton.cpp; sourceTree = "<group>"; };
233237 E45B94611A170B9A008E95EB /* docview.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = docview.cpp; sourceTree = "<group>"; };
234238 E460B2DC2739716500CD9407 /* Version */ = {isa = PBXFileReference; lastKnownFileType = text; name = Version; path = ../Version; sourceTree = "<group>"; };
235239 E4653CB018A0CC7D0022377B /* textctrl_addition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = textctrl_addition.mm; sourceTree = "<group>"; };
@@ -541,6 +545,8 @@
541545 E420BE05188574AD00A2B983 /* MyDocument.h */,
542546 E420BE06188574AD00A2B983 /* MyGLCanvas.cpp */,
543547 E420BE07188574AD00A2B983 /* MyGLCanvas.h */,
548+ E4589CEE28D5FD6400F55785 /* MyToggleButton.cpp */,
549+ E4589CED28D5FD6400F55785 /* MyToggleButton.h */,
544550 E420BE08188574AD00A2B983 /* MyIPCSupport.cpp */,
545551 E420BE09188574AD00A2B983 /* MyIPCSupport.h */,
546552 E420BE0A188574AD00A2B983 /* MyListCtrl_orig.cpp */,
@@ -881,6 +887,7 @@
881887 E4FC77BD183E4F3F0064FB2E /* ruby_types.c in Sources */,
882888 E4FC77BE183E4F3F0064FB2E /* Trackball.c in Sources */,
883889 E4FC77BF183E4F3F0064FB2E /* Types.c in Sources */,
890+ E4589CEF28D5FD6400F55785 /* MyToggleButton.cpp in Sources */,
884891 E4FC7CA6183F94D30064FB2E /* buildInfo.c in Sources */,
885892 E420BDEF1885746700A2B983 /* ConsoleFrame.cpp in Sources */,
886893 E420BDF11885746700A2B983 /* GlobalParameterFilesFrame.cpp in Sources */,
@@ -937,6 +944,7 @@
937944 E4059FB728C46A6E0052B36B /* ConsoleFrame.cpp in Sources */,
938945 E403568628D0B7B0008E2C46 /* MyListCtrl.cpp in Sources */,
939946 E4059FB828C46A6E0052B36B /* filedlg.mm in Sources */,
947+ E4589CF028D5FD6400F55785 /* MyToggleButton.cpp in Sources */,
940948 E4059FB928C46A6E0052B36B /* GlobalParameterFilesFrame.cpp in Sources */,
941949 E4059FBA28C46A6E0052B36B /* GlobalParameterFrame.cpp in Sources */,
942950 E4059FBC28C46A6E0052B36B /* MoleculeView.cpp in Sources */,
--- a/wxSources/ConsoleFrame.cpp
+++ b/wxSources/ConsoleFrame.cpp
@@ -142,7 +142,7 @@ ConsoleFrame::CreateConsoleFrame(wxFrame *parent)
142142 ConsoleFrame *frame = new ConsoleFrame(parent, _T("Molby Console"), origin, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
143143
144144 frame->OnCreate();
145- frame->SetClientSize(size);
145+ frame->SetClientSize(FromFrameDIP(frame, size));
146146
147147 return frame;
148148 }
--- a/wxSources/GlobalParameterFilesFrame.cpp
+++ b/wxSources/GlobalParameterFilesFrame.cpp
@@ -67,9 +67,9 @@ GlobalParameterFilesFrame::OnCreate()
6767 wxBoxSizer *sizer0;
6868 sizer0 = new wxBoxSizer(wxVERTICAL);
6969 listctrl = new MyListCtrl();
70- listctrl->Create(this, wxID_ANY, wxDefaultPosition, size);
71- listctrl->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 80);
72- listctrl->InsertColumn(1, _T("directory"), wxLIST_FORMAT_LEFT, 240);
70+ listctrl->Create(this, wxID_ANY, wxDefaultPosition, FromFrameDIP(this, size));
71+ listctrl->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, FromFrameDIP(this, 80));
72+ listctrl->InsertColumn(1, _T("directory"), wxLIST_FORMAT_LEFT, FromFrameDIP(this, 240));
7373 sizer0->Add(listctrl, 1, wxLEFT | wxRIGHT | wxEXPAND, 0);
7474 {
7575 wxBoxSizer *sizer1;
@@ -100,7 +100,7 @@ GlobalParameterFilesFrame::CreateGlobalParameterFilesFrame(wxWindow *parent)
100100 wxSize size(700, 240);
101101 #endif
102102
103- GlobalParameterFilesFrame *frame = new GlobalParameterFilesFrame(parent, _T("Load/Unload Global Parameters"), origin, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
103+ GlobalParameterFilesFrame *frame = new GlobalParameterFilesFrame(parent, _T("Load/Unload Global Parameters"), FromFrameDIP(parent, origin), FromFrameDIP(parent, size), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
104104
105105 frame->OnCreate();
106106 return frame;
--- a/wxSources/GlobalParameterFrame.cpp
+++ b/wxSources/GlobalParameterFrame.cpp
@@ -67,7 +67,7 @@ GlobalParameterFrame::CreateGlobalParameterFrame(wxWindow *parent)
6767 wxPoint origin(26, 40);
6868 wxSize size(774, 300);
6969 #endif
70- GlobalParameterFrame *frame = new GlobalParameterFrame(parent, _T("Global Parameters"), origin, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
70+ GlobalParameterFrame *frame = new GlobalParameterFrame(parent, _T("Global Parameters"), FromFrameDIP(parent, origin), FromFrameDIP(parent, size), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
7171
7272 frame->OnCreate();
7373 return frame;
--- a/wxSources/MoleculeView.cpp
+++ b/wxSources/MoleculeView.cpp
@@ -119,10 +119,11 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
119119
120120 // Make a document frame
121121 frame = new wxDocChildFrame(doc, this, GetMainFrame(), wxID_ANY, _T("New Molby Document"),
122- wxPoint(10, 24), wxSize(680, 400),
122+ wxDefaultPosition, wxDefaultSize,
123123 wxDEFAULT_FRAME_STYLE |
124124 wxNO_FULL_REPAINT_ON_RESIZE);
125-
125+ frame->SetPosition(FromFrameDIP(frame, wxPoint(10, 24)));
126+ frame->SetClientSize(FromFrameDIP(frame, wxSize(680, 400)));
126127 canvas = NULL;
127128 mview = NULL;
128129 listmenu = NULL;
@@ -202,16 +203,16 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
202203 myID_SelectButton, myID_BondButton, myID_EraseButton
203204 };
204205 for (i = 0; i < 6; i++) {
205- tbuttons[i] = new wxToggleButton(panel1, ids[i], labels[i], wxDefaultPosition, wxSize(40, 32), wxTOGGLEBUTTON_STYLE);
206+ tbuttons[i] = new MyToggleButton(panel1, ids[i], labels[i], wxDefaultPosition, FromFrameDIP(frame, wxSize(40, 32)), wxTOGGLEBUTTON_STYLE);
206207 if (ctrlFont)
207208 tbuttons[i]->SetFont(*ctrlFont);
208- sizer2->Add(tbuttons[i], 0, wxALL | wxEXPAND, 3);
209+ sizer2->Add(tbuttons[i], 0, wxALL | wxEXPAND, FromFrameDIP(frame, 3));
209210 }
210211 tbuttons[0]->SetValue(true);
211212 }
212213 { // Information text
213- infotext = new wxStaticText(panel1, -1, wxT(""), wxDefaultPosition, wxSize(80, 32), wxST_NO_AUTORESIZE | wxBORDER_SUNKEN);
214- infotext->SetMinSize(wxSize(80, 32));
214+ infotext = new wxStaticText(panel1, -1, wxT(""), wxDefaultPosition, FromFrameDIP(frame, wxSize(80, 32)), wxST_NO_AUTORESIZE | wxBORDER_SUNKEN);
215+ infotext->SetMinSize(FromFrameDIP(frame, wxSize(80, 32)));
215216 #if defined(__WXMSW__)
216217 infotext->SetFont(*wxSMALL_FONT);
217218 #else
@@ -221,7 +222,7 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
221222 sizer2->Add(infotext, 1, wxALL | wxEXPAND, 3); // Can expand horizontally
222223 }
223224 { // Custom progress indicator
224- progress = new MyProgressIndicator(panel1, myID_StopProgressButton, wxDefaultPosition, wxSize(12, 24));
225+ progress = new MyProgressIndicator(panel1, myID_StopProgressButton, wxDefaultPosition, FromFrameDIP(frame, wxSize(12, 24)));
225226 sizer2->Add(progress, 0, wxALL | wxEXPAND, 3);
226227 }
227228 sizer1->Add(sizer2, 0, wxALL | wxEXPAND, 0);
@@ -247,7 +248,7 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
247248 { // Vertical sizer containing [Canvas, [button, mySlider]]
248249 wxBoxSizer *sizer32 = new wxBoxSizer(wxVERTICAL);
249250 {
250- canvas = new MyGLCanvas(this, panel1, wxDefaultPosition, wxSize(100, 100));
251+ canvas = new MyGLCanvas(this, panel1, wxDefaultPosition, FromFrameDIP(frame, wxSize(100, 100)));
251252 sizer32->Add(canvas, 1, wxALL | wxEXPAND, 0);
252253
253254 // Let the MyGLCanvas pass the keyboard event to this
@@ -258,10 +259,10 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
258259 {
259260 #include "../bitmaps/rotate_y.xpm"
260261 wxBitmap bmp2(rotate_y_xpm);
261- wxBitmapButton *button2 = new wxBitmapButton(panel1, -1, bmp2, wxDefaultPosition, wxSize(21, 21), wxTOGGLEBUTTON_STYLE);
262+ wxBitmapButton *button2 = new wxBitmapButton(panel1, -1, bmp2, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)), wxTOGGLEBUTTON_STYLE);
262263 sizer321->Add(button2, 0, 0, 0);
263264 button2->Disable();
264- MySlider *slider2 = new MySlider(panel1, myID_RotateYSlider, wxHORIZONTAL, wxDefaultPosition, wxSize(21, 21));
265+ MySlider *slider2 = new MySlider(panel1, myID_RotateYSlider, wxHORIZONTAL, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)));
265266 sizer321->Add(slider2, 1, wxEXPAND);
266267 }
267268 sizer32->Add(sizer321, 0, wxEXPAND);
@@ -274,11 +275,11 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
274275 { // "Rotate bond" button and mySlider
275276 #include "../bitmaps/rotate_x.xpm"
276277 wxBitmap bmp3(rotate_x_xpm);
277- wxBitmapButton *button3 = new wxBitmapButton(panel1, -1, bmp3, wxDefaultPosition, wxSize(21, 21), wxTOGGLEBUTTON_STYLE);
278+ wxBitmapButton *button3 = new wxBitmapButton(panel1, -1, bmp3, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)), wxTOGGLEBUTTON_STYLE);
278279 button3->Disable();
279280 sizer33->Add(button3, 0, 0, 0);
280281
281- MySlider *slider3 = new MySlider(panel1, myID_RotateXSlider, wxVERTICAL, wxDefaultPosition, wxSize(21, 21));
282+ MySlider *slider3 = new MySlider(panel1, myID_RotateXSlider, wxVERTICAL, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, 21)));
282283 sizer33->Add(slider3, 1, wxEXPAND);
283284 }
284285 sizer3->Add(sizer33, 0, wxALL | wxEXPAND, 0);
@@ -290,27 +291,27 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
290291 { // Horizontal sizer containing frame controls
291292
292293 const int height = 18;
293- frameControlPanel = new wxPanel(panel1, myID_FrameControlPanel, wxDefaultPosition, wxSize(200, height));
294+ frameControlPanel = new wxPanel(panel1, myID_FrameControlPanel, wxDefaultPosition, FromFrameDIP(frame, wxSize(200, height)));
294295 wxBoxSizer *sizer4 = new wxBoxSizer(wxHORIZONTAL);
295296 {
296- frameSlider = new wxSlider(frameControlPanel, myID_FrameSlider, 0, 0, 1, wxDefaultPosition, wxSize(40, height - 2));
297+ frameSlider = new wxSlider(frameControlPanel, myID_FrameSlider, 0, 0, 1, wxDefaultPosition, FromFrameDIP(frame, wxSize(40, height - 2)));
297298 frameSlider->Enable(false);
298299 sizer4->Add(frameSlider, 1, wxALL | wxEXPAND, 1);
299300
300301 #include "../bitmaps/jump_to_start.xpm"
301302 wxBitmap bmp41(jump_to_start_xpm);
302- wxBitmapButton *button41 = new wxBitmapButton(frameControlPanel, myID_JumpToStartButton, bmp41, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
303+ wxBitmapButton *button41 = new wxBitmapButton(frameControlPanel, myID_JumpToStartButton, bmp41, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
303304 sizer4->Add(button41, 0, wxEXPAND);
304305 ConnectMouseDownEvents(button41, MoleculeView::OnFrameButtonAction, this);
305306
306307 #include "../bitmaps/play_backward.xpm"
307308 wxBitmap bmp42(play_backward_xpm);
308- wxBitmapButton *button42 = new wxBitmapButton(frameControlPanel, myID_PlayBackwardButton, bmp42, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
309+ wxBitmapButton *button42 = new wxBitmapButton(frameControlPanel, myID_PlayBackwardButton, bmp42, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
309310 sizer4->Add(button42, 0, wxEXPAND);
310311 ConnectMouseDownEvents(button42, MoleculeView::OnFrameButtonAction, this);
311312
312313 {
313- frameText = new wxTextCtrl(frameControlPanel, myID_FrameText, wxT(""), wxDefaultPosition, wxSize(40, height));
314+ frameText = new wxTextCtrl(frameControlPanel, myID_FrameText, wxT(""), wxDefaultPosition, FromFrameDIP(frame, wxSize(40, height)));
314315 if (ctrlFont) {
315316 wxTextAttr attr(*wxBLACK, wxNullColour, *ctrlFont);
316317 frameText->SetDefaultStyle(attr);
@@ -321,17 +322,17 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
321322
322323 #include "../bitmaps/play_forward.xpm"
323324 wxBitmap bmp43(play_forward_xpm);
324- wxBitmapButton *button43 = new wxBitmapButton(frameControlPanel, myID_PlayForwardButton, bmp43, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
325+ wxBitmapButton *button43 = new wxBitmapButton(frameControlPanel, myID_PlayForwardButton, bmp43, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
325326 sizer4->Add(button43, 0, wxEXPAND);
326327 ConnectMouseDownEvents(button43, MoleculeView::OnFrameButtonAction, this);
327328
328329 #include "../bitmaps/jump_to_end.xpm"
329330 wxBitmap bmp44(jump_to_end_xpm);
330- wxBitmapButton *button44 = new wxBitmapButton(frameControlPanel, myID_JumpToEndButton, bmp44, wxDefaultPosition, wxSize(16, height), wxTOGGLEBUTTON_STYLE);
331+ wxBitmapButton *button44 = new wxBitmapButton(frameControlPanel, myID_JumpToEndButton, bmp44, wxDefaultPosition, FromFrameDIP(frame, wxSize(16, height)), wxTOGGLEBUTTON_STYLE);
331332 sizer4->Add(button44, 0, wxEXPAND);
332333 ConnectMouseDownEvents(button44, MoleculeView::OnFrameButtonAction, this);
333334
334- wxPanel *spacer = new wxPanel(frameControlPanel, -1, wxDefaultPosition, wxSize(21, height));
335+ wxPanel *spacer = new wxPanel(frameControlPanel, -1, wxDefaultPosition, FromFrameDIP(frame, wxSize(21, height)));
335336 sizer4->Add(spacer, 0, wxEXPAND);
336337 }
337338 frameControlPanel->SetSizer(sizer4);
@@ -349,7 +350,7 @@ MoleculeView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
349350 frame->SetSizer(mainsizer);
350351
351352 mainsizer->Layout();
352- splitter->SetSashPosition(240, true);
353+ splitter->SetSashPosition(FromFrameDIP(frame, 240), true);
353354
354355 // Initialize table view
355356 MainView_createColumnsForTableAtIndex(mview, 0);
@@ -1457,7 +1458,7 @@ MainViewCallback_addTableColumn(MainView *mview, const char *name, int width, in
14571458 return 0;
14581459 idx = listctrl->GetColumnCount();
14591460 listctrl->InsertColumn(idx, nstr, wxLIST_FORMAT_LEFT);
1460- listctrl->SetColumnWidth(idx, width * 10);
1461+ listctrl->SetColumnWidth(idx, FromFrameDIP(listctrl, width * 10));
14611462 return idx;
14621463 }
14631464
--- a/wxSources/MoleculeView.h
+++ b/wxSources/MoleculeView.h
@@ -22,11 +22,11 @@
2222
2323 #include "../MolLib/MolLib.h"
2424 #include "MyListCtrl.h"
25+#include "MyToggleButton.h"
2526
2627 class MyDocument;
2728 class MyGLCanvas;
2829 class wxMenu;
29-class wxToggleButton;
3030 class wxStaticText;
3131 class wxChoice;
3232 class MyProgressIndicator;
@@ -41,7 +41,7 @@ public:
4141 MyListCtrl *listctrl;
4242 wxMenu *file_history_menu;
4343 wxMenu *edit_menu;
44- wxToggleButton *tbuttons[6];
44+ MyToggleButton *tbuttons[6];
4545 wxStaticText *infotext;
4646 MyProgressIndicator *progress;
4747 wxPanel *frameControlPanel;
@@ -55,7 +55,7 @@ public:
5555
5656 MyDocument *MolDocument() { return (MyDocument *)m_viewDocument; }
5757 MyListCtrl *GetListCtrl() { return listctrl; }
58- wxToggleButton *GetToggleButtonAtIndex(int i) { return (i >= 0 && i < 6 ? tbuttons[i] : NULL); }
58+ MyToggleButton *GetToggleButtonAtIndex(int i) { return (i >= 0 && i < 6 ? tbuttons[i] : NULL); }
5959
6060 bool OnCreate(wxDocument *doc, long flags);
6161 void OnDraw(wxDC *dc);
--- a/wxSources/MyApp.cpp
+++ b/wxSources/MyApp.cpp
@@ -353,8 +353,9 @@ bool MyApp::OnInit(void)
353353
354354 // Create the main frame window
355355 frame = new MyFrame((wxDocManager *) m_docManager, (wxFrame *) NULL,
356- _T("Molby"), wxPoint(0, 0), wxSize(800, 600),
356+ _T("Molby"), wxDefaultPosition, wxDefaultSize,
357357 wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
358+ frame->SetClientSize(FromFrameDIP(frame, wxSize(800, 600)));
358359
359360 // Give it an icon (this is ignored in MDI mode: uses resources)
360361 #ifdef __WXMSW__
@@ -1824,13 +1825,13 @@ AboutDialog::AboutDialog():
18241825 free(s2);
18251826 free(s3);
18261827 #if defined(__WXMSW__)
1827- wxFont *textFont0 = new wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
1828- wxFont *textFont1 = new wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1829- wxFont *textFont2 = new wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1828+ wxFont *textFont0 = new wxFont(FromFrameDIP(this, 12), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
1829+ wxFont *textFont1 = new wxFont(FromFrameDIP(this, 10), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1830+ wxFont *textFont2 = new wxFont(FromFrameDIP(this, 9), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
18301831 #else
1831- wxFont *textFont0 = new wxFont(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
1832- wxFont *textFont1 = new wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1833- wxFont *textFont2 = new wxFont(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1832+ wxFont *textFont0 = new wxFont(FromFrameDIP(this, 14), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
1833+ wxFont *textFont1 = new wxFont(FromFrameDIP(this, 12), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1834+ wxFont *textFont2 = new wxFont(FromFrameDIP(this, 11), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
18341835 #endif
18351836 wxBoxSizer *vsizer1 = new wxBoxSizer(wxVERTICAL);
18361837 wxBoxSizer *vsizer2 = new wxBoxSizer(wxVERTICAL);
@@ -1842,17 +1843,17 @@ AboutDialog::AboutDialog():
18421843 wxStaticText *stext2 = new wxStaticText(this, -1, str2);
18431844 stext2->SetFont(*textFont1);
18441845 wxStaticBitmap *staticBitmap = new wxStaticBitmap(this, -1, *molbyBitmap);
1845- vsizer2->Add(stext1, 0, wxALL | wxEXPAND, 2);
1846- vsizer2->Add(stext2, 0, wxALL | wxEXPAND, 2);
1847- hsizer1->AddSpacer(20);
1848- hsizer1->Add(staticBitmap, 0, 0, 10);
1849- hsizer1->AddSpacer(20);
1850- hsizer1->Add(vsizer2, 0, wxALL | wxEXPAND, 5);
1846+ vsizer2->Add(stext1, 0, wxALL | wxEXPAND, FromFrameDIP(this, 2));
1847+ vsizer2->Add(stext2, 0, wxALL | wxEXPAND, FromFrameDIP(this, 2));
1848+ hsizer1->AddSpacer(FromFrameDIP(this, 20));
1849+ hsizer1->Add(staticBitmap, 0, 0, FromFrameDIP(this, 10));
1850+ hsizer1->AddSpacer(FromFrameDIP(this, 20));
1851+ hsizer1->Add(vsizer2, 0, wxALL | wxEXPAND, FromFrameDIP(this, 5));
18511852 wxStaticText *stext3 = new wxStaticText(this, -1, str3);
18521853 stext3->SetFont(*textFont2);
1853- vsizer1->Add(hsizer1, 0, wxALL | wxEXPAND, 5);
1854- vsizer1->Add(stext3, 0, wxALL | wxEXPAND, 5);
1855- vsizer1->Add(this->CreateButtonSizer(wxOK), 0, wxALL | wxEXPAND, 10);
1854+ vsizer1->Add(hsizer1, 0, wxALL | wxEXPAND, FromFrameDIP(this, 5));
1855+ vsizer1->Add(stext3, 0, wxALL | wxEXPAND, FromFrameDIP(this, 5));
1856+ vsizer1->Add(this->CreateButtonSizer(wxOK), 0, wxALL | wxEXPAND, FromFrameDIP(this, 10));
18561857 vsizer1->Layout();
18571858 this->SetSizerAndFit(vsizer1);
18581859 this->Centre();
@@ -2166,12 +2167,12 @@ MyAppCallback_getTextWithPrompt(const char *prompt, char *buf, int bufsize)
21662167 { // Vertical sizer containing [prompt, textbox, buttons]
21672168 wxBoxSizer *sizer1;
21682169 sizer1 = new wxBoxSizer(wxVERTICAL);
2169- stext = new wxStaticText(dialog, -1, pstr, wxDefaultPosition, wxSize(200, 22));
2170- sizer1->Add(stext, 0, wxEXPAND | wxALL, 6);
2171- tctrl = new wxTextCtrl(dialog, -1, defstr, wxDefaultPosition, wxSize(200, 22));
2172- sizer1->Add(tctrl, 0, wxEXPAND | wxALL, 6);
2170+ stext = new wxStaticText(dialog, -1, pstr, wxDefaultPosition, FromFrameDIP(dialog, wxSize(200, 22)));
2171+ sizer1->Add(stext, 0, wxEXPAND | wxALL, FromFrameDIP(dialog, 6));
2172+ tctrl = new wxTextCtrl(dialog, -1, defstr, wxDefaultPosition, FromFrameDIP(dialog, wxSize(200, 22)));
2173+ sizer1->Add(tctrl, 0, wxEXPAND | wxALL, FromFrameDIP(dialog, 6));
21732174 wxSizer *bsizer = dialog->CreateButtonSizer(wxOK | wxCANCEL);
2174- sizer1->Add(bsizer, 0, wxEXPAND | wxALL, 6);
2175+ sizer1->Add(bsizer, 0, wxEXPAND | wxALL, FromFrameDIP(dialog, 6));
21752176 sizer1->Layout();
21762177 dialog->SetSizerAndFit(sizer1);
21772178 dialog->Centre(wxBOTH);
--- a/wxSources/MyApp.h
+++ b/wxSources/MyApp.h
@@ -56,6 +56,17 @@ class MyDocument;
5656 #define wxTOGGLEBUTTON_STYLE 0
5757 #endif
5858
59+#if wxCHECK_VERSION(3,1,0)
60+#define FromFrameDIP(frame, x) frame->FromDIP(x)
61+#define ToFrameDIP(frame, x) frame->ToDIP(x)
62+#else
63+#define FromFrameDIP(frame, x) (x)
64+#define ToFrameDIP(frame, x) (x)
65+#endif
66+
67+#define FromDCDIP FromFrameDIP
68+#define ToDCDIP ToFrameDIP
69+
5970 enum {
6071 myMenuID_MyFirstMenuItem = 12000,
6172 myMenuID_Import = 12001,
--- a/wxSources/MyListCtrl.cpp
+++ b/wxSources/MyListCtrl.cpp
@@ -24,6 +24,12 @@
2424 #include "wx/menu.h"
2525 #include "wx/sizer.h"
2626
27+#if wxCHECK_VERSION(3,1,0)
28+#define FromFrameDIP(frame, x) frame->FromDIP(x)
29+#else
30+#define FromFrameDIP(frame, x) (x)
31+#endif
32+
2733 const wxEventType MyListCtrlEvent = wxNewEventType();
2834
2935 IMPLEMENT_DYNAMIC_CLASS(MyListCtrl, wxWindow)
@@ -76,12 +82,6 @@ MyListCtrl::Create(wxWindow* parent, wxWindowID wid, const wxPoint& pos, const w
7682 header = new wxWindow(this, 1001, wxPoint(0, 0), wxSize(size.x, 16));
7783 scroll = new wxScrolledWindow(this, 1002, wxPoint(0, 16), wxSize(size.x, (size.y <= 16 ? -1 : size.y - 16)));
7884
79- // Set sizer
80- wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
81- vsizer->Add(header, wxSizerFlags(0).Expand().Border(wxALL, 0));
82- vsizer->Add(scroll, wxSizerFlags(1).Expand().Border(wxALL, 0));
83- this->SetSizer(vsizer);
84-
8585 // Connect events
8686 header->Bind(wxEVT_PAINT, &MyListCtrl::OnPaintHeader, this);
8787 scroll->Bind(wxEVT_PAINT, &MyListCtrl::OnPaint, this);
@@ -110,7 +110,14 @@ MyListCtrl::Create(wxWindow* parent, wxWindowID wid, const wxPoint& pos, const w
110110 rowHeight = h + 2;
111111 dc.GetTextExtent(_T("M"), &w, &h, &descent, &leading, &headerFont);
112112 headerHeight = h + 2;
113+ header->SetSize(wxSize(size.x, headerHeight));
113114 }
115+
116+ // Set sizer
117+ wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL);
118+ vsizer->Add(header, wxSizerFlags(0).Expand().Border(wxALL, 0));
119+ vsizer->Add(scroll, wxSizerFlags(1).Expand().Border(wxALL, 0));
120+ this->SetSizer(vsizer);
114121
115122 selectionChangeNotificationRequired = false;
116123 selectionChangeNotificationEnabled = true;
@@ -179,7 +186,7 @@ MyListCtrl::RefreshTable(bool refreshWindow)
179186 }
180187 // rowHeight = dataSource->GetRowHeight(this);
181188 // "+4" is for drawing marker during cell dragging
182- pageHeight = rowHeight * nrows + 4;
189+ pageHeight = rowHeight * nrows + FromFrameDIP(this, 4);
183190 // Set the subwindow infos
184191 sz.y = headerHeight;
185192 header->SetMinSize(sz);
@@ -237,6 +244,7 @@ MyListCtrl::OnPaint(wxPaintEvent &event)
237244 wxTextAttr attr;
238245 wxString str;
239246 int x, y;
247+ int mg = FromFrameDIP(this, 2);
240248 row = floor(oy / rowHeight);
241249 for (j = row; j < nrows; j++) {
242250 float fg0[4], bg0[4];
@@ -321,8 +329,8 @@ MyListCtrl::OnPaint(wxPaintEvent &event)
321329 if (i == ncols - 1) {
322330 dc.DrawLine(x + colWidths[i], y, x + colWidths[i], y + rowHeight - 1);
323331 }
324- dc.SetClippingRegion(x + 2, y, colWidths[i] - 4, rowHeight - 1);
325- dc.DrawText(str, x + 2, y);
332+ dc.SetClippingRegion(x + mg, y, colWidths[i] - mg * 2, rowHeight - 1);
333+ dc.DrawText(str, x + mg, y);
326334 dc.DestroyClippingRegion();
327335 x += colWidths[i];
328336 if (x > ox + sz.x)
@@ -351,6 +359,7 @@ MyListCtrl::OnPaintHeader(wxPaintEvent &event)
351359 int x, x1;
352360 int i;
353361 wxTextAttr attr;
362+ int mg = FromFrameDIP(this, 2);
354363 scroll->CalcUnscrolledPosition(0, 0, &ox, &oy);
355364 x = -ox;
356365 for (i = 0; i < ncols; i++) {
@@ -358,8 +367,8 @@ MyListCtrl::OnPaintHeader(wxPaintEvent &event)
358367 if (x1 > 0) {
359368 wxString str = colNames[i];
360369 dc.DrawLine(x + colWidths[i], 0, x + colWidths[i], sz.y - 1);
361- dc.SetClippingRegion(x + 2, 0, colWidths[i] - 4, sz.y);
362- dc.DrawText(str, x + 2, 0);
370+ dc.SetClippingRegion(x + mg, 0, colWidths[i] - mg * 2, sz.y);
371+ dc.DrawText(str, x + mg, 0);
363372 dc.DestroyClippingRegion();
364373 }
365374 x = x1;
--- /dev/null
+++ b/wxSources/MyToggleButton.cpp
@@ -0,0 +1,78 @@
1+/*
2+ * MyToggleButton
3+ * Molby
4+ *
5+ * Created by Toshi Nagata on 2022/09/17.
6+ * Copyright 2022 Toshi Nagata. All rights reserved.
7+ *
8+ This program is free software; you can redistribute it and/or modify
9+ it under the terms of the GNU General Public License as published by
10+ the Free Software Foundation version 2 of the License.
11+
12+ This program is distributed in the hope that it will be useful,
13+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ GNU General Public License for more details.
16+ */
17+
18+#include "MyToggleButton.h"
19+#include "wx/dcclient.h"
20+
21+IMPLEMENT_DYNAMIC_CLASS(MyToggleButton, wxToggleButton)
22+
23+BEGIN_EVENT_TABLE(MyToggleButton, wxToggleButton)
24+EVT_PAINT(MyToggleButton::OnPaint)
25+EVT_LEFT_DOWN(MyToggleButton::OnLeftDown)
26+EVT_LEFT_UP(MyToggleButton::OnLeftUp)
27+END_EVENT_TABLE()
28+
29+void
30+MyToggleButton::OnPaint(wxPaintEvent &event)
31+{
32+ wxPaintDC dc(this);
33+ wxSize size = GetSize();
34+ dc.SetPen(*wxGREY_PEN);
35+ const wxBrush *brush;
36+ if (IsPressed())
37+ brush = wxTheBrushList->FindOrCreateBrush(wxColour(128, 128, 128));
38+ else if (GetValue())
39+ brush = wxTheBrushList->FindOrCreateBrush(wxColour(180, 180, 180));
40+ else
41+ brush = wxTheBrushList->FindOrCreateBrush(wxColour(240, 240, 240));
42+ dc.SetBrush(*brush);
43+ dc.DrawRectangle(0, 0, size.x, size.y);
44+ wxString label = GetLabel();
45+ int w, h, descent;
46+ int x, y;
47+ dc.GetTextExtent(label, &w, &h, &descent);
48+ x = (size.x - w) / 2;
49+ y = (size.y - h) / 2;
50+ dc.SetPen(*wxBLACK_PEN);
51+ dc.DrawText(label, x, y);
52+}
53+
54+void
55+MyToggleButton::OnLeftDown(wxMouseEvent &event)
56+{
57+ CaptureMouse();
58+ SetPressed(true);
59+ Refresh();
60+}
61+
62+void
63+MyToggleButton::OnLeftUp(wxMouseEvent &event)
64+{
65+ ReleaseMouse();
66+ SetPressed(false);
67+ int x = event.GetX();
68+ int y = event.GetY();
69+ wxSize sz = GetSize();
70+ if (x > 0 && x < sz.x && y > 0 && y < sz.y) {
71+ SetValue(!GetValue());
72+ wxCommandEvent cmdevt(wxEVT_TOGGLEBUTTON, GetId());
73+ cmdevt.SetInt(GetValue());
74+ cmdevt.SetEventObject(this);
75+ ProcessCommand(cmdevt);
76+ Refresh();
77+ }
78+}
--- /dev/null
+++ b/wxSources/MyToggleButton.h
@@ -0,0 +1,50 @@
1+/*
2+ * MyToggleButton.h
3+ * Molby
4+ *
5+ * Created by Toshi Nagata on 2022/09/17.
6+ * Copyright 2022 Toshi Nagata. All rights reserved.
7+ *
8+ This program is free software; you can redistribute it and/or modify
9+ it under the terms of the GNU General Public License as published by
10+ the Free Software Foundation version 2 of the License.
11+
12+ This program is distributed in the hope that it will be useful,
13+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ GNU General Public License for more details.
16+ */
17+
18+#ifndef __MyToggleButton_h__
19+#define __MyToggleButton_h__
20+
21+#include "wx/tglbtn.h"
22+
23+class MyToggleButton: public wxToggleButton
24+{
25+public:
26+ MyToggleButton() {}
27+ 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)
28+ : wxToggleButton(parent, id, label, pos, size, style, val, name) {
29+ m_isPressed = m_value = false;
30+ }
31+
32+ void OnPaint(wxPaintEvent &event);
33+ void OnLeftDown(wxMouseEvent &event);
34+ void OnLeftUp(wxMouseEvent &event);
35+ void SetValue(bool val) { m_value = val; Refresh(); }
36+ bool GetValue() { return m_value; }
37+ void SetPressed(bool flag) { m_isPressed = flag; Refresh(); }
38+ bool IsPressed() { return m_isPressed; }
39+
40+private:
41+ bool m_isPressed;
42+ bool m_value;
43+ bool m_isEnabled;
44+ DECLARE_DYNAMIC_CLASS(MyToggleButton)
45+ DECLARE_EVENT_TABLE()
46+};
47+
48+
49+#endif /* __MyToggleButton_h__ */
50+
--- a/wxSources/RubyDialogFrame.cpp
+++ b/wxSources/RubyDialogFrame.cpp
@@ -83,7 +83,7 @@ RubyDialogFrame::RubyDialogFrame(wxWindow* parent, wxWindowID wid, const wxStrin
8383 buttonSizer = NULL; // Will be created later
8484 myTimer = NULL; // Will be created when necessary
8585 boxSizer = new wxBoxSizer(wxVERTICAL);
86- boxSizer->Add(contentSizer, 1, wxALL | wxEXPAND, 14);
86+ boxSizer->Add(contentSizer, 1, wxALL | wxEXPAND, FromFrameDIP(this, 14));
8787 this->SetSizer(boxSizer);
8888 boxSizer->Layout();
8989 }
@@ -196,7 +196,7 @@ RubyDialogFrame::CreateStandardButtons(const char *oktitle, const char *cancelti
196196 if (sizer == NULL)
197197 return; /* Cannot create */
198198 if (buttonSizer == NULL) {
199- boxSizer->Add(sizer, 0, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, 14);
199+ boxSizer->Add(sizer, 0, wxBOTTOM | wxLEFT | wxRIGHT | wxEXPAND, FromFrameDIP(this, 14));
200200 buttonSizer = sizer;
201201 } else {
202202 boxSizer->Replace(buttonSizer, sizer);
@@ -872,7 +872,8 @@ wxRectFromRDRect(RDRect rframe)
872872 RDSize
873873 RubyDialogCallback_windowMinSize(RubyDialog *dref)
874874 {
875- wxSize minSize = ((RubyDialogFrame *)dref)->GetMinSize();
875+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
876+ wxSize minSize = ToFrameDIP(dframe, dframe->GetMinSize());
876877 RDSize rminSize;
877878 rminSize.width = minSize.GetWidth();
878879 rminSize.height = minSize.GetHeight();
@@ -882,16 +883,18 @@ RubyDialogCallback_windowMinSize(RubyDialog *dref)
882883 void
883884 RubyDialogCallback_setWindowMinSize(RubyDialog *dref, RDSize size)
884885 {
886+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
885887 wxSize minSize;
886888 minSize.x = (int)size.width;
887889 minSize.y = (int)size.height;
888- ((RubyDialogFrame *)dref)->SetMinSize(minSize);
890+ dframe->SetMinSize(FromFrameDIP(dframe, minSize));
889891 }
890892
891893 RDSize
892894 RubyDialogCallback_windowSize(RubyDialog *dref)
893895 {
894- wxSize minSize = ((RubyDialogFrame *)dref)->GetSize();
896+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
897+ wxSize minSize = ToFrameDIP(dframe, dframe->GetSize());
895898 RDSize rminSize;
896899 rminSize.width = minSize.GetWidth();
897900 rminSize.height = minSize.GetHeight();
@@ -900,9 +903,10 @@ RubyDialogCallback_windowSize(RubyDialog *dref)
900903 void
901904 RubyDialogCallback_setWindowSize(RubyDialog *dref, RDSize size)
902905 {
906+ RubyDialogFrame *dframe = (RubyDialogFrame *)dref;
903907 wxSize wsize((int)size.width, (int)size.height);
904- ((RubyDialogFrame *)dref)->SetSize(wsize);
905- ((RubyDialogFrame *)dref)->CentreOnScreen();
908+ dframe->SetSize(FromFrameDIP(dframe, wsize));
909+ dframe->CentreOnScreen();
906910 }
907911
908912 void
@@ -969,10 +973,10 @@ RubyDialogCallback_createItem(RubyDialog *dref, const char *type, const char *ti
969973 rect.SetPosition(wxDefaultPosition);
970974 rect.SetSize(wxDefaultSize);
971975 } else {
972- rect.SetX(rect.x + offset.x);
973- rect.SetY(rect.y + offset.y);
974- rect.SetWidth(rect.width + offset.width);
975- rect.SetHeight(rect.height + offset.height);
976+ rect.SetX(FromFrameDIP(parent, rect.x + offset.x));
977+ rect.SetY(FromFrameDIP(parent, rect.y + offset.y));
978+ rect.SetWidth(FromFrameDIP(parent, rect.width + offset.width));
979+ rect.SetHeight(FromFrameDIP(parent, rect.height + offset.height));
976980 }
977981
978982 if (strcmp(type, "text") == 0) {
@@ -1055,14 +1059,14 @@ RubyDialogCallback_createItem(RubyDialog *dref, const char *type, const char *ti
10551059 if (title[0] != 0 || strcmp(type, "textfield") == 0) {
10561060 /* Resize the frame rect as necessary */
10571061 RDSize minSize = RubyDialogCallback_sizeOfString((RDItem *)control, title);
1058- wxSize size = control->GetSize();
1062+ wxSize size = ToFrameDIP(parent, control->GetSize());
10591063 if (size.GetHeight() < minSize.height)
10601064 size.SetHeight(minSize.height);
10611065 if (size.GetWidth() < minSize.width)
10621066 size.SetWidth(minSize.width);
10631067 size.SetWidth(size.GetWidth() + offset.width);
10641068 size.SetHeight(size.GetHeight() + offset.height);
1065- control->SetSize(size);
1069+ control->SetSize(FromFrameDIP(parent, size));
10661070 }
10671071
10681072 if (wxDynamicCast(control, wxTextCtrl) != NULL) {
@@ -1094,10 +1098,11 @@ RubyDialogCallback_indexOfItem(RubyDialog *dref, RDItem *item)
10941098 void
10951099 RubyDialogCallback_moveItemUnderView(RDItem *item, RDItem *superView, RDPoint origin)
10961100 {
1101+ wxWindow *sv = (wxWindow *)superView;
10971102 if (item == NULL || superView == NULL || item == superView)
10981103 return;
1099- if (((wxWindow *)item)->Reparent((wxWindow *)superView)) {
1100- ((wxWindow *)item)->Move(origin.x, origin.y);
1104+ if (((wxWindow *)item)->Reparent(sv)) {
1105+ ((wxWindow *)item)->Move(FromFrameDIP(sv, origin.x), FromFrameDIP(sv, origin.y));
11011106 }
11021107 }
11031108
@@ -1110,29 +1115,39 @@ RubyDialogCallback_superview(RDItem *item)
11101115 RDRect
11111116 RubyDialogCallback_frameOfItem(RDItem *item)
11121117 {
1113- wxRect rect = ((wxWindow *)item)->GetRect();
1118+ wxWindow *wp = (wxWindow *)item;
1119+ wxRect rect = wp->GetRect();
11141120 if (gRubyDialogIsFlipped) {
1115- wxWindow *parent = ((wxWindow *)item)->GetParent();
1121+ wxWindow *parent = wp->GetParent();
11161122 if (parent != NULL) {
11171123 wxRect superRect = parent->GetRect();
11181124 rect.SetY(superRect.GetHeight() - rect.GetHeight() - rect.GetY());
11191125 }
11201126 }
1127+ rect.x = ToFrameDIP(wp, rect.x);
1128+ rect.y = ToFrameDIP(wp, rect.y);
1129+ rect.width = ToFrameDIP(wp, rect.width);
1130+ rect.height = ToFrameDIP(wp, rect.height);
11211131 return RDRectFromwxRect(rect);
11221132 }
11231133
11241134 void
11251135 RubyDialogCallback_setFrameOfItem(RDItem *item, RDRect rect)
11261136 {
1137+ wxWindow *wp = (wxWindow *)item;
11271138 wxRect wrect = wxRectFromRDRect(rect);
11281139 if (gRubyDialogIsFlipped) {
1129- wxWindow *parent = ((wxWindow *)item)->GetParent();
1140+ wxWindow *parent = wp->GetParent();
11301141 if (parent != NULL) {
11311142 wxRect srect = parent->GetRect();
11321143 wrect.SetY(srect.GetHeight() - wrect.GetHeight() - wrect.GetY());
11331144 }
11341145 }
1135- ((wxWindow *)item)->SetSize(wrect);
1146+ wrect.x = FromFrameDIP(wp, wrect.x);
1147+ wrect.y = FromFrameDIP(wp, wrect.y);
1148+ wrect.width = FromFrameDIP(wp, wrect.width);
1149+ wrect.height = FromFrameDIP(wp, wrect.height);
1150+ wp->SetSize(wrect);
11361151 }
11371152
11381153 void
@@ -1303,14 +1318,14 @@ RubyDialogCallback_setFontForItem(RDItem *item, int size, int family, int style,
13031318 }
13041319 if (textctrl != NULL) {
13051320 wxTextAttr newAttr;
1306- wxFont newFont(size, family, style, weight);
1321+ wxFont newFont(FromFrameDIP(textctrl, size), family, style, weight);
13071322 newAttr.SetFont(newFont);
13081323 textctrl->SetDefaultStyle(newAttr);
13091324 #if __WXMAC__
13101325 textctrl->SetFont(newFont);
13111326 #endif
13121327 } else {
1313- ctrl->SetFont(wxFont(size, family, style, weight));
1328+ ctrl->SetFont(wxFont(FromFrameDIP(ctrl, size), family, style, weight));
13141329 wxString label = ctrl->GetLabel();
13151330 ctrl->SetLabel(_(""));
13161331 ctrl->SetLabel(label); /* Update the control size */
@@ -1326,7 +1341,7 @@ RubyDialogCallback_getFontForItem(RDItem *item, int *size, int *family, int *sty
13261341 wxTextAttr attr = ctrl->GetDefaultStyle();
13271342 wxFont font = attr.GetFont();
13281343 if (size != NULL)
1329- *size = font.GetPointSize();
1344+ *size = ToFrameDIP(ctrl, font.GetPointSize());
13301345 if (family != NULL) {
13311346 n = font.GetFamily();
13321347 *family = (n == wxFONTFAMILY_DEFAULT ? 1 :
@@ -1498,6 +1513,8 @@ RubyDialogCallback_sizeOfString(RDItem *item, const char *s)
14981513 break;
14991514 s1 = s2 + 1;
15001515 }
1516+ size.width = ToFrameDIP(((wxWindow *)item), size.width);
1517+ size.height = ToFrameDIP(((wxWindow *)item), size.height);
15011518 return size;
15021519 }
15031520
@@ -1508,8 +1525,8 @@ RubyDialogCallback_resizeToBest(RDItem *item)
15081525 RDSize rsize;
15091526 size = ((wxWindow *)item)->GetBestSize();
15101527 ((wxWindow *)item)->SetSize(size);
1511- rsize.width = size.GetWidth();
1512- rsize.height = size.GetHeight();
1528+ rsize.width = ToFrameDIP(((wxWindow *)item), size.GetWidth());
1529+ rsize.height = ToFrameDIP(((wxWindow *)item), size.GetHeight());
15131530 return rsize;
15141531 }
15151532
@@ -1686,7 +1703,7 @@ RubyDialogCallback_drawEllipse(RDDeviceContext *dc, float x, float y, float r1,
16861703 wxDC *dcp = (wxDC *)dc;
16871704 if (dcp == NULL)
16881705 return;
1689- dcp->DrawEllipse(x - r1, y - r2, r1 * 2, r2 * 2);
1706+ dcp->DrawEllipse(FromDCDIP(dcp, x - r1), FromDCDIP(dcp, y - r2), FromDCDIP(dcp, r1 * 2), FromDCDIP(dcp, r2 * 2));
16901707 }
16911708
16921709 void
@@ -1698,8 +1715,8 @@ RubyDialogCallback_drawLine(RDDeviceContext *dc, int ncoords, float *coords)
16981715 wxPoint *pts = new wxPoint[ncoords];
16991716 int i;
17001717 for (i = 0; i < ncoords; i++) {
1701- pts[i].x = (int)coords[i * 2];
1702- pts[i].y = (int)coords[i * 2 + 1];
1718+ pts[i].x = FromDCDIP(dcp, (int)coords[i * 2]);
1719+ pts[i].y = FromDCDIP(dcp, (int)coords[i * 2 + 1]);
17031720 }
17041721 dcp->DrawLines(ncoords, pts);
17051722 delete [] pts;
@@ -1712,9 +1729,9 @@ RubyDialogCallback_drawRectangle(RDDeviceContext *dc, float x, float y, float wi
17121729 if (dcp == NULL)
17131730 return;
17141731 if (round > 0.0)
1715- dcp->DrawRoundedRectangle((int)x, (int)y, (int)width, (int)height, (int)round);
1732+ dcp->DrawRoundedRectangle(FromDCDIP(dcp, x), FromDCDIP(dcp, y), FromDCDIP(dcp, width), FromDCDIP(dcp, height), FromDCDIP(dcp, round));
17161733 else
1717- dcp->DrawRectangle((int)x, (int)y, (int)width, (int)height);
1734+ dcp->DrawRectangle(FromDCDIP(dcp, x), FromDCDIP(dcp, y), FromDCDIP(dcp, width), FromDCDIP(dcp, height));
17181735 }
17191736
17201737 void
@@ -1724,7 +1741,7 @@ RubyDialogCallback_drawText(RDDeviceContext *dc, const char *s, float x, float y
17241741 if (dcp == NULL)
17251742 return;
17261743 wxString str(s, WX_DEFAULT_CONV);
1727- dcp->DrawText(str, (int)x, (int)y);
1744+ dcp->DrawText(str, FromDCDIP(dcp, x), FromDCDIP(dcp, y));
17281745 }
17291746
17301747 void
@@ -1737,7 +1754,7 @@ RubyDialogCallback_setFont(RDDeviceContext *dc, void **args)
17371754 wxFont font = dcp->GetFont();
17381755 for (i = 0; args[i] != NULL; i += 2) {
17391756 if (strcmp((const char *)args[i], "size") == 0) {
1740- float size = *((float *)(args[i + 1]));
1757+ float size = FromDCDIP(dcp, *((float *)(args[i + 1])));
17411758 font.SetPointSize((int)size);
17421759 } else if (strcmp((const char *)args[i], "style") == 0) {
17431760 long style = (intptr_t)(args[i + 1]);
@@ -1790,7 +1807,7 @@ RubyDialogCallback_setPen(RDDeviceContext *dc, void **args)
17901807 wxColour col((int)(fp[0] * 255.0), (int)(fp[1] * 255.0), (int)(fp[2] * 255.0), (int)(fp[3] * 255.0));
17911808 pen.SetColour(col);
17921809 } else if (strcmp((const char *)args[i], "width") == 0) {
1793- float width = *((float *)(args[i + 1]));
1810+ float width = FromDCDIP(dcp, *((float *)(args[i + 1])));
17941811 pen.SetWidth((int)width);
17951812 } else if (strcmp((const char *)args[i], "style") == 0) {
17961813 long style = (intptr_t)(args[i + 1]);
旧リポジトリブラウザで表示