Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxWidgets port of pen thickness override #47

Open
JamesBremner opened this issue Dec 30, 2024 · 6 comments
Open

wxWidgets port of pen thickness override #47

JamesBremner opened this issue Dec 30, 2024 · 6 comments
Assignees
Labels
enhancement status:test Ready to be tested

Comments

@JamesBremner
Copy link
Owner

In order to port #46 to wxWidgets:

  • Add menu option

DXF_Viewer/src/windex.cpp

Lines 148 to 155 in cbd1cf7

mv.append("Pen",
[&](const std::string &title) {
penDlg(fm,dxf);
auto fname = fm.text();
if( fname != "DXF Viewer")
dxf.LoadFile( fname );
fm.update();
});

  • Add dialog

void penDlg(wex::gui &fm, dxfv::CDxf& dxf)
{
wex::gui &dlg = wex::maker::make();
dlg.move( 200,200,400,300);
dlg.text("Over-ride pen thickness");
wex::label& lbThick = wex::maker::make<wex::label>(dlg);
lbThick.move(50,50,100,30);
lbThick.text("Thickness pixels");
wex::editbox& ebThick = wex::maker::make<wex::editbox>(dlg);
ebThick.move(200,50,100,30);
ebThick.text("1");
wex::checkbox& chk = wex::maker::make<wex::checkbox>(dlg);
chk.move(100,100,100,30);
chk.text(" Enable");
wex::button& bOK = wex::maker::make<wex::button>(dlg);
bOK.move(200,150,50,30);
bOK.text("OK");
bOK.events().click(
[&]
{
int thick = 0;
if( chk.isChecked() )
thick = atoi(ebThick.text().c_str());
dxf.penThickOverride( thick );
dlg.endModal();
});
dlg.showModal(fm);
}

  • Set pen thickness in any draw() methods that do not already have this

image

All changes in wxWidgets.cpp only

@asmwarrior It is far too many years ago that I last used wxWidgets, so you will have to do this yourself.

@asmwarrior
Copy link
Collaborator

I have implemented one, see here:

#46 (comment)

for some discussion, thanks.

@JamesBremner JamesBremner added the status:test Ready to be tested label Jan 5, 2025
@JamesBremner
Copy link
Owner Author

JamesBremner commented Jan 6, 2025

Due to implementation of #48 you will need to add cRunWatch to your wxWidgets build from the raven-set repo https://github.com/JamesBremner/raven-set and the boost header files.

@asmwarrior
Copy link
Collaborator

Due to implementation of #48 you will need to add cRunWatch to your wxWidgets build from the raven-set repo https://github.com/JamesBremner/raven-set and the boost header files.

I think the cRunWatch feature could be wrapped by a conditional preprocessor, so that people don't need that feature do not need to enable that feature by default.

Thanks.

@JamesBremner
Copy link
Owner Author

The timing feature is disabled by default.

// uncomment next line to enable timing profiler
//raven::set::cRunWatch::Start();

@asmwarrior
Copy link
Collaborator

The timing feature is disabled by default.

// uncomment next line to enable timing profiler
//raven::set::cRunWatch::Start();

I think a conditional preprocessor directive is needed. If that condition is not enabled, all the #include directive and related code should be branch out.

@asmwarrior
Copy link
Collaborator

I have wrote the comment:

#46 (comment)

I have already implemented the similar pen setting dialog for the wxWidgets port, but I think I don't want to "reload the dxf and reparse the dxf" when I close the pen setting dialog get closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement status:test Ready to be tested
Projects
None yet
Development

No branches or pull requests

2 participants