| 306 | |
| 307 | |
| 308 | CanvasLayoutDialog::CanvasLayoutDialog(wxString _project_name, TemplateLegend* _legend, TemplateCanvas* _canvas, const wxString& title, const wxPoint& pos, const wxSize& size) |
| 309 | : wxDialog(NULL, wxID_ANY, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ) |
| 310 | { |
| 311 | legend_shape = NULL; |
| 312 | |
| 313 | project_name = _project_name; |
| 314 | template_canvas = _canvas; |
| 315 | template_legend = _legend; |
| 316 | |
| 317 | is_resize = false; |
| 318 | is_initmap = false; |
| 319 | |
| 320 | canvas = new wxShapeCanvas(this, wxID_ANY, pos, size); |
| 321 | canvas->SetBackgroundColour(*wxWHITE); |
| 322 | canvas->SetCursor(wxCursor(wxCURSOR_CROSS)); |
| 323 | |
| 324 | diagram = new wxDiagram(); |
| 325 | diagram->SetCanvas(canvas); |
| 326 | canvas->SetDiagram(diagram); |
| 327 | |
| 328 | // map |
| 329 | map_shape = new wxBitmapShape(); |
| 330 | map_shape->SetCanvas(template_canvas); |
| 331 | canvas->AddShape(map_shape); |
| 332 | map_shape->SetDraggable(false); |
| 333 | map_shape->SetMaintainAspectRatio(true); |
| 334 | map_shape->Show(false); |
| 335 | |
| 336 | CanvasLayoutEvtHandler *evthandler = new CanvasLayoutEvtHandler(); |
| 337 | evthandler->SetShape(map_shape); |
| 338 | evthandler->SetPreviousHandler(map_shape->GetEventHandler()); |
| 339 | map_shape->SetEventHandler(evthandler); |
| 340 | |
| 341 | // legend |
| 342 | if (template_legend) { |
| 343 | legend_shape = new wxBitmapShape(); |
| 344 | legend_shape->SetCanvas(template_legend); |
| 345 | canvas->AddShape(legend_shape); |
| 346 | |
| 347 | legend_shape->SetX(50 + legend_shape->GetWidth()); |
| 348 | legend_shape->SetY(120); |
| 349 | legend_shape->MakeControlPoints(); |
| 350 | legend_shape->SetMaintainAspectRatio(true); |
| 351 | legend_shape->Show(false); |
| 352 | |
| 353 | CanvasLayoutEvtHandler *evthandler1 = new CanvasLayoutEvtHandler(); |
| 354 | evthandler1->SetShape(legend_shape); |
| 355 | evthandler1->SetPreviousHandler(legend_shape->GetEventHandler()); |
| 356 | legend_shape->SetEventHandler(evthandler1); |
| 357 | } |
| 358 | |
| 359 | //diagram->ShowAll(1); |
| 360 | |
| 361 | // ui |
| 362 | m_cb = new wxCheckBox(this, wxID_ANY, _("Show Legend")); |
| 363 | m_cb->SetValue(true); |
| 364 | if (template_legend == NULL) m_cb->Hide(); |
| 365 | m_no_bg = new wxCheckBox(this, wxID_ANY, _("Use Transparent Legend Background")); |
nothing calls this directly
no test coverage detected