src/gui_actions.cpp

changeset 538
2f85d4d286e5
parent 530
f9476dbd87ec
child 539
72ad83a67165
equal deleted inserted replaced
537:1add0ee96fb3 538:2f85d4d286e5
99 new LDEmpty, 99 new LDEmpty,
100 new LDBFC (BFCType), 100 new LDBFC (BFCType),
101 new LDEmpty, 101 new LDEmpty,
102 }); 102 });
103 103
104 g_win->fullRefresh(); 104 g_win->doFullRefresh();
105 } 105 }
106 106
107 // ============================================================================= 107 // =============================================================================
108 // ----------------------------------------------------------------------------- 108 // -----------------------------------------------------------------------------
109 DEFINE_ACTION (NewFile, CTRL (N)) 109 DEFINE_ACTION (NewFile, CTRL (N))
145 } 145 }
146 146
147 // ============================================================================= 147 // =============================================================================
148 // ----------------------------------------------------------------------------- 148 // -----------------------------------------------------------------------------
149 DEFINE_ACTION (Close, CTRL (W)) 149 DEFINE_ACTION (Close, CTRL (W))
150 { if (!LDFile::current()->safeToClose()) 150 { if (!LDFile::current()->isSafeToClose())
151 return; 151 return;
152 152
153 delete LDFile::current(); 153 delete LDFile::current();
154 } 154 }
155 155
266 } 266 }
267 267
268 // ============================================================================= 268 // =============================================================================
269 // ----------------------------------------------------------------------------- 269 // -----------------------------------------------------------------------------
270 DEFINE_ACTION (SelectByColor, CTRL_SHIFT (A)) 270 DEFINE_ACTION (SelectByColor, CTRL_SHIFT (A))
271 { short colnum = g_win->getSelectedColor(); 271 { int colnum = g_win->getSelectedColor();
272 272
273 if (colnum == -1) 273 if (colnum == -1)
274 return; // no consensus on color 274 return; // no consensus on color
275 275
276 LDFile::current()->clearSelection(); 276 LDFile::current()->clearSelection();
286 // ----------------------------------------------------------------------------- 286 // -----------------------------------------------------------------------------
287 DEFINE_ACTION (SelectByType, 0) 287 DEFINE_ACTION (SelectByType, 0)
288 { if (selection().isEmpty()) 288 { if (selection().isEmpty())
289 return; 289 return;
290 290
291 LDObject::Type type = g_win->uniformSelectedType(); 291 LDObject::Type type = g_win->getUniformSelectedType();
292 292
293 if (type == LDObject::Unidentified) 293 if (type == LDObject::Unidentified)
294 return; 294 return;
295 295
296 // If we're selecting subfile references, the reference filename must also 296 // If we're selecting subfile references, the reference filename must also
441 // ----------------------------------------------------------------------------- 441 // -----------------------------------------------------------------------------
442 DEFINE_ACTION (Screenshot, 0) 442 DEFINE_ACTION (Screenshot, 0)
443 { setlocale (LC_ALL, "C"); 443 { setlocale (LC_ALL, "C");
444 444
445 int w, h; 445 int w, h;
446 uchar* imgdata = g_win->R()->screencap (w, h); 446 uchar* imgdata = g_win->R()->getScreencap (w, h);
447 QImage img = imageFromScreencap (imgdata, w, h); 447 QImage img = imageFromScreencap (imgdata, w, h);
448 448
449 str root = basename (LDFile::current()->name()); 449 str root = basename (LDFile::current()->name());
450 450
451 if (root.right (4) == ".dat") 451 if (root.right (4) == ".dat")
546 { if (g_win->R()->camera() == GL::Free) 546 { if (g_win->R()->camera() == GL::Free)
547 return; 547 return;
548 548
549 bool ok; 549 bool ok;
550 double depth = QInputDialog::getDouble (g_win, "Set Draw Depth", 550 double depth = QInputDialog::getDouble (g_win, "Set Draw Depth",
551 fmt ("Depth value for %1 Camera:", g_win->R()->cameraName()), 551 fmt ("Depth value for %1 Camera:", g_win->R()->getCameraName()),
552 g_win->R()->depthValue(), -10000.0f, 10000.0f, 3, &ok); 552 g_win->R()->getDepthValue(), -10000.0f, 10000.0f, 3, &ok);
553 553
554 if (ok) 554 if (ok)
555 g_win->R()->setDepthValue (depth); 555 g_win->R()->setDepthValue (depth);
556 } 556 }
557 557
623 623
624 if (selection().size() == 1) 624 if (selection().size() == 1)
625 defval = selection()[0]->getIndex(); 625 defval = selection()[0]->getIndex();
626 626
627 int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval, 627 int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval,
628 1, LDFile::current()->numObjs(), 1, &ok); 628 1, LDFile::current()->getObjectCount(), 1, &ok);
629 629
630 if (!ok || (obj = LDFile::current()->object (idx - 1)) == null) 630 if (!ok || (obj = LDFile::current()->getObject (idx - 1)) == null)
631 return; 631 return;
632 632
633 LDFile::current()->clearSelection(); 633 LDFile::current()->clearSelection();
634 obj->select(); 634 obj->select();
635 g_win->updateSelection(); 635 g_win->updateSelection();

mercurial