347
181
QPixmap copyIcon = ipeIcon("copy");
348
182
QPixmap pasteIcon = ipeIcon("paste");
350
QMimeSourceFactory::defaultFactory()->setPixmap("new", newIcon);
351
QMimeSourceFactory::defaultFactory()->setPixmap("open", openIcon);
352
QMimeSourceFactory::defaultFactory()->setPixmap("save", saveIcon);
353
QMimeSourceFactory::defaultFactory()->setPixmap("undo", undoIcon);
354
QMimeSourceFactory::defaultFactory()->setPixmap("redo", undoIcon);
355
QMimeSourceFactory::defaultFactory()->setPixmap("cut", cutIcon);
356
QMimeSourceFactory::defaultFactory()->setPixmap("copy", copyIcon);
357
QMimeSourceFactory::defaultFactory()->setPixmap("paste", pasteIcon);
359
184
IpePreferences *prefs = IpePreferences::Static();
361
186
// --------------------------------------------------------------------
363
// --------------------------------------------------------------------
365
setUsesBigPixmaps(prefs->iBigToolButtons);
367
iFileTools = new QToolBar( this, "file tools" );
368
iFileTools->setLabel(tr("File tools"));
371
= new QToolButton(newIcon, tr("New document"), QString::null,
372
this, SLOT(NewDoc()), iFileTools, "new document" );
373
QWhatsThis::add(fileNew, tr(fileNewText));
375
QToolButton *fileOpen
376
= new QToolButton(openIcon, tr("Open file"), QString::null,
377
this, SLOT(Load()), iFileTools, "open file" );
378
QWhatsThis::add(fileOpen, tr(fileOpenText));
380
QToolButton *fileSave
381
= new QToolButton(saveIcon, tr("Save file"), QString::null,
382
this, SLOT(Save()), iFileTools, "save file" );
383
QWhatsThis::add(fileSave, tr(fileSaveText));
385
iFileTools->addSeparator();
388
= new QToolButton(cutIcon, tr("Cut"), QString::null,
389
this, SLOT(Cut()), iFileTools, "cut" );
390
QWhatsThis::add(editCut, tr(cutcopyText));
392
QToolButton *editCopy
393
= new QToolButton(copyIcon, tr("Copy"), QString::null,
394
this, SLOT(Copy()), iFileTools, "copy" );
395
QWhatsThis::add(editCopy, tr(cutcopyText));
397
QToolButton *editPaste
398
= new QToolButton(pasteIcon, tr("Paste"), QString::null,
399
this, SLOT(Paste()), iFileTools, "paste" );
400
QWhatsThis::add(editPaste, tr(cutcopyText));
402
iFileTools->addSeparator();
404
(void) QWhatsThis::whatsThisButton(iFileTools);
188
// --------------------------------------------------------------------
190
iFileMenu = menuBar()->addMenu(tr("&File"));
191
iEditMenu = menuBar()->addMenu(tr("&Edit"));
192
iSnapMenu = menuBar()->addMenu(tr("&Snap"));
193
iModeMenu = menuBar()->addMenu(tr("&Mode"));
194
iZoomMenu = menuBar()->addMenu(tr("&Zoom"));
195
iLayerMenu = menuBar()->addMenu(tr("&Layer"));
196
iViewMenu = menuBar()->addMenu(tr("&View"));
197
iPageMenu = menuBar()->addMenu(tr("&Page"));
198
iIpeletMenu = menuBar()->addMenu(tr("&Ipelets"));
199
menuBar()->addSeparator();
200
iHelpMenu = menuBar()->addMenu(tr("&Help"));
202
// --------------------------------------------------------------------
204
// --------------------------------------------------------------------
206
iFileTools = addToolBar(tr("File"));
207
iResolutionTools = addToolBar(tr("Resolution"));
208
iPageTools = addToolBar(tr("Page"));
209
iSnapTools = addToolBar(tr("Snap"));
211
iObjectTools = addToolBar(tr("Objects"));
213
// --------------------------------------------------------------------
214
// Create docking windows
215
// --------------------------------------------------------------------
217
iPropertiesTools = new QDockWidget(tr("Properties"), this);
218
addDockWidget(Qt::LeftDockWidgetArea, iPropertiesTools);
219
iPropertiesTools->setAllowedAreas(Qt::LeftDockWidgetArea|
220
Qt::RightDockWidgetArea);
222
iLayerTools = new QDockWidget(tr("Layers"), this);
223
addDockWidget(Qt::LeftDockWidgetArea, iLayerTools);
224
iLayerTools->setAllowedAreas(Qt::LeftDockWidgetArea|
225
Qt::RightDockWidgetArea);
227
iBookmarkTools = new QDockWidget(tr("Bookmarks"), this);
228
addDockWidget(Qt::RightDockWidgetArea, iBookmarkTools);
229
iBookmarkTools->setAllowedAreas(Qt::LeftDockWidgetArea|
230
Qt::RightDockWidgetArea);
232
// --------------------------------------------------------------------
234
// --------------------------------------------------------------------
236
QAction *newAct = new QAction(newIcon, tr("&New document"), this);
237
newAct->setShortcut(Key("File|New document"));
238
// newAct->setStatusTip(tr("Create a new document"));
239
newAct->setWhatsThis(tr(fileNewText));
240
connect(newAct, SIGNAL(triggered()), this, SLOT(NewDoc()));
241
iFileTools->addAction(newAct);
243
QAction *openAct = new QAction(openIcon, tr("Open file"), this);
244
openAct->setShortcut(Key("File|Open file"));
245
openAct->setWhatsThis(tr(fileOpenText));
246
connect(openAct, SIGNAL(triggered()), this, SLOT(Load()));
247
iFileTools->addAction(openAct);
249
QAction *saveAct = new QAction(saveIcon, tr("Save file"), this);
250
saveAct->setShortcut(Key("File|Save file"));
251
saveAct->setWhatsThis(tr(fileSaveText));
252
connect(saveAct, SIGNAL(triggered()), this, SLOT(Save()));
253
iFileTools->addAction(saveAct);
255
iFileTools->addSeparator();
257
iCutAction = new IpeAction(ECmdCut, cutIcon, tr("Cut"), this);
258
iCutAction->setShortcut(Key("Edit|Cut"));
259
iCutAction->setWhatsThis(tr(cutcopyText));
260
connect(iCutAction, SIGNAL(triggered(int)), this, SLOT(Cmd(int)));
261
iFileTools->addAction(iCutAction);
263
iCopyAction = new IpeAction(ECmdCopy, copyIcon, tr("Copy"), this);
264
iCopyAction->setShortcut(Key("Edit|Copy"));
265
iCopyAction->setWhatsThis(tr(cutcopyText));
266
connect(iCopyAction, SIGNAL(triggered(int)), this, SLOT(Cmd(int)));
267
iFileTools->addAction(iCopyAction);
269
QAction *pasteAct = new IpeAction(ECmdPaste, pasteIcon, tr("Paste"), this);
270
pasteAct->setShortcut(Key("Edit|Paste"));
271
pasteAct->setWhatsThis(tr(cutcopyText));
272
connect(pasteAct, SIGNAL(triggered(int)), this, SLOT(Cmd(int)));
273
iFileTools->addAction(pasteAct);
275
iFileTools->addSeparator();
277
QAction *whatsThisAct = QWhatsThis::createAction();
278
iFileTools->addAction(whatsThisAct);
406
282
// --------------------------------------------------------------------
407
283
// Resolution tool bar
408
284
// --------------------------------------------------------------------
410
iResolutionTools = new QToolBar(this, "resolution tools");
411
iResolutionTools->setLabel(tr("Resolution tool"));
286
QAction *normalSizeAct = new QAction(tr("&Normal size"), this);
287
normalSizeAct->setShortcut(Key("Zoom|Normal size"));
288
connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(NormalSize()));
413
iResolution = new ZoomSpinBox(iResolutionTools);
414
QToolTip::add(iResolution, tr("Screen resolution"));
415
QWhatsThis::add(iResolution, tr(resolutionText));
416
iResolution->setSuffix(tr(" dpi"));
290
iResolution = new ZoomSpinBox();
291
iResolution->setWhatsThis(tr(resolutionText));
292
iResolution->setToolTip(tr("Screen resolution"));
293
iResolution->installEventFilter(this);
417
294
connect(iResolution, SIGNAL(valueChanged(int)),
418
295
this, SLOT(ResolutionChanged(int)));
296
iResolutionTools->addWidget(iResolution);
420
298
// --------------------------------------------------------------------
422
300
// --------------------------------------------------------------------
424
iPageTools = new QToolBar(this, "page tools");
425
iPageTools->setLabel(tr("Page tools"));
427
iPageNumber = new IpeSpinBox(iPageTools, "page number");
428
QToolTip::add(iPageNumber, tr("Current page"));
429
QWhatsThis::add(iPageNumber, tr(pageNumberText));
302
iPageNumber = new IpeSpinBox();
303
iPageNumber->setToolTip(tr("Current page"));
304
iPageNumber->setWhatsThis(tr(pageNumberText));
430
305
iPageNumber->setPrefix(tr("Page "));
431
306
connect(iPageNumber, SIGNAL(valueChanged(int)),
432
307
this, SLOT(PageChanged(int)));
433
// iPageNumber->setFocusPolicy(NoFocus);
308
iPageNumber->installEventFilter(this);
435
iViewNumber = new IpeSpinBox(iPageTools, "view number");
436
QToolTip::add(iViewNumber, tr("Current view"));
437
QWhatsThis::add(iViewNumber, tr(viewNumberText));
310
iViewNumber = new IpeSpinBox();
311
iViewNumber->setToolTip(tr("Current view"));
312
iViewNumber->setWhatsThis(tr(viewNumberText));
438
313
iViewNumber->setPrefix(tr("View "));
439
314
connect(iViewNumber, SIGNAL(valueChanged(int)),
440
315
this, SLOT(ViewChanged(int)));
441
// iViewNumber->setFocusPolicy(NoFocus);
443
// --------------------------------------------------------------------
445
// --------------------------------------------------------------------
447
iColorTools = new QToolBar(this, "color tools");
448
iColorTools->setLabel(tr("Color tools"));
450
iStrokeColorStack = new QWidgetStack(iColorTools);
451
QToolTip::add(iStrokeColorStack, tr("Stroke color"));
452
QWhatsThis::add(iStrokeColorStack, tr(strokeColorText));
453
iStrokeColor = new QComboBox(false);
454
connect(iStrokeColor, SIGNAL(activated(int)),
455
SLOT(SetStrokeColorName(int)));
456
iAbsStrokeColor = new QPushButton(tr("Stroke"), 0);
457
iStrokeColorStack->setMaximumHeight(iStrokeColor->sizeHint().height());
458
connect(iAbsStrokeColor, SIGNAL(clicked()),
459
this, SLOT(SetStrokeColor()));
460
iStrokeColorStack->addWidget(iStrokeColor, 0);
461
iStrokeColorStack->addWidget(iAbsStrokeColor, 1);
463
iFillColorStack = new QWidgetStack(iColorTools);
464
QToolTip::add(iFillColorStack, tr("Fill color"));
465
QWhatsThis::add(iFillColorStack, tr(fillColorText));
466
iFillColor = new QComboBox(false);
467
connect(iFillColor, SIGNAL(activated(int)),
468
SLOT(SetFillColorName(int)));
469
iAbsFillColor = new QPushButton(tr("Fill"), 0);
470
iFillColorStack->setMaximumHeight(iFillColor->sizeHint().height());
471
connect(iAbsFillColor, SIGNAL(clicked()),
472
this, SLOT(SetFillColor()));
473
iFillColorStack->addWidget(iFillColor, 0);
474
iFillColorStack->addWidget(iAbsFillColor, 1);
476
// --------------------------------------------------------------------
477
// Line width/style/arrow tool bar
478
// --------------------------------------------------------------------
480
iLineTools = new QToolBar(this, "line tools");
481
iLineTools->setLabel(tr("Line style settings"));
483
iLineWidthStack = new QWidgetStack(iLineTools);
484
QToolTip::add(iLineWidthStack, tr("Line width"));
485
QWhatsThis::add(iLineWidthStack, tr(lineWidthText));
486
iLineWidth = new QComboBox(false);
487
connect(iLineWidth, SIGNAL(activated(int)),
488
SLOT(LineWidthChanged(int)));
489
iAbsLineWidth = new DecimalSpinBox(0, 10000, 200);
490
connect(iAbsLineWidth, SIGNAL(valueChanged(int)),
491
SLOT(AbsLineWidthChanged(int)));
492
iLineWidthStack->addWidget(iLineWidth, 0);
493
iLineWidthStack->addWidget(iAbsLineWidth, 1);
495
iDashStyle = new QComboBox(false, iLineTools);
496
QToolTip::add(iDashStyle, tr("Line dash pattern"));
497
QWhatsThis::add(iDashStyle, tr(lineDashText));
498
connect(iDashStyle, SIGNAL(activated(int)),
499
SLOT(DashStyleChanged(int)));
501
QPixmap arrowIcon1 = ipeIcon("arrowNone");
502
QPixmap arrowIcon2 = ipeIcon("arrowRight");
503
QPixmap arrowIcon3 = ipeIcon("arrowLeft");
504
QPixmap arrowIcon4 = ipeIcon("arrowBoth");
505
iArrow = new QComboBox(false, iLineTools);
506
QToolTip::add(iArrow, tr("Arrow"));
507
QWhatsThis::add(iArrow, tr(arrowText));
508
iArrow->insertItem(arrowIcon1);
509
iArrow->insertItem(arrowIcon2);
510
iArrow->insertItem(arrowIcon3);
511
iArrow->insertItem(arrowIcon4);
512
connect(iArrow, SIGNAL(activated(int)),
513
SLOT(ArrowChanged(int)));
514
iAttributes.iForwardArrow = false;
515
iAttributes.iBackwardArrow = false;
517
iArrowSizeStack = new QWidgetStack(iLineTools);
518
QToolTip::add(iArrowSizeStack, tr("Arrow size"));
519
QWhatsThis::add(iArrowSizeStack, tr(arrowSizeText));
520
iArrowSize = new QComboBox(false);
521
connect(iArrowSize, SIGNAL(activated(int)),
522
SLOT(ArrowSizeChanged(int)));
523
iAbsArrowSize = new DecimalSpinBox(200, 100000, 1000);
524
connect(iAbsArrowSize, SIGNAL(valueChanged(int)),
525
SLOT(AbsArrowSizeChanged(int)));
526
iArrowSizeStack->addWidget(iArrowSize, 0);
527
iArrowSizeStack->addWidget(iAbsArrowSize, 1);
530
// --------------------------------------------------------------------
531
// Mark and text sizes
532
// --------------------------------------------------------------------
534
iSizeTools = new QToolBar(this, "size tools");
535
iSizeTools->setLabel(tr("Mark and text size settings"));
537
QPixmap markIcon = ipeIcon("marks");
538
iMarkShape = new QComboBox(false, iSizeTools, "mark shape");
539
QToolTip::add(iMarkShape, tr("Mark shape"));
540
QWhatsThis::add(iMarkShape, tr(markShapeText));
541
connect(iMarkShape, SIGNAL(activated(int)),
542
SLOT(MarkShapeChanged(int)));
543
iMarkShape->insertItem(markIcon, tr("Circle"));
544
iMarkShape->insertItem(markIcon, tr("Disc"));
545
iMarkShape->insertItem(markIcon, tr("Box"));
546
iMarkShape->insertItem(markIcon, tr("Square"));
547
iMarkShape->insertItem(markIcon, tr("Cross"));
548
iAttributes.iMarkShape = iMarkShape->currentItem() + 1;
550
iMarkSizeStack = new QWidgetStack(iSizeTools);
551
QToolTip::add(iMarkSizeStack, tr("Mark size"));
552
QWhatsThis::add(iMarkSizeStack, tr(markSizeText));
553
iMarkSize = new QComboBox(false);
554
connect(iMarkSize, SIGNAL(activated(int)),
555
SLOT(MarkSizeChanged(int)));
556
iAbsMarkSize = new DecimalSpinBox(200, 100000, 1000);
557
connect(iAbsMarkSize, SIGNAL(valueChanged(int)),
558
SLOT(AbsMarkSizeChanged(int)));
559
iMarkSizeStack->addWidget(iMarkSize, 0);
560
iMarkSizeStack->addWidget(iAbsMarkSize, 1);
562
iTextSizeStack = new QWidgetStack(iSizeTools);
563
QToolTip::add(iTextSizeStack, tr("Font size"));
564
QWhatsThis::add(iTextSizeStack, tr(textSizeText));
565
iTextSize = new QComboBox(false);
566
connect(iTextSize, SIGNAL(activated(int)),
567
SLOT(TextSizeChanged(int)));
568
iAbsTextSize = new DecimalSpinBox(4000, 50000, 1000);
569
connect(iAbsTextSize, SIGNAL(valueChanged(int)),
570
SLOT(AbsTextSizeChanged(int)));
571
iTextSizeStack->addWidget(iTextSize, 0);
572
iTextSizeStack->addWidget(iAbsTextSize, 1);
316
iViewNumber->installEventFilter(this);
318
iPageTools->addWidget(iPageNumber);
319
iPageTools->addWidget(iViewNumber);
574
321
// --------------------------------------------------------------------
582
329
QPixmap snapAngleIcon = ipeIcon("snapangle");
583
330
QPixmap snapAutoIcon = ipeIcon("snapauto");
585
QMimeSourceFactory::defaultFactory()->setPixmap("snapvtx", snapVtxIcon);
586
QMimeSourceFactory::defaultFactory()->setPixmap("snapbd", snapVtxIcon);
587
QMimeSourceFactory::defaultFactory()->setPixmap("snapint", snapVtxIcon);
588
QMimeSourceFactory::defaultFactory()->setPixmap("snapgrid", snapGridIcon);
589
QMimeSourceFactory::defaultFactory()->setPixmap("snapangle", snapAngleIcon);
590
QMimeSourceFactory::defaultFactory()->setPixmap("snapauto", snapAutoIcon);
592
iSnapTools = new QToolBar(this, "snap tools");
593
iSnapTools->setLabel(tr("Snap tools"));
595
iSnapActionGroup = new QActionGroup(this, 0, false);
332
iSnapActionGroup = new QActionGroup(this);
597
334
iSnapAction[0] = new QAction(iSnapActionGroup);
598
335
iSnapAction[0]->setText(tr("Snap to vertices"));
599
iSnapAction[0]->setAccel(Key("F4", "Snap|Vertices"));
600
iSnapAction[0]->setIconSet(snapVtxIcon);
601
iSnapAction[0]->addTo(iSnapTools);
336
iSnapAction[0]->setShortcut(Key("Snap|Vertices"));
337
iSnapAction[0]->setIcon(snapVtxIcon);
603
339
iSnapAction[1] = new QAction(iSnapActionGroup);
604
340
iSnapAction[1]->setText(tr("Snap to boundary"));
605
iSnapAction[1]->setAccel(Key("F5", "Snap|Boundary"));
606
iSnapAction[1]->setIconSet(snapBdIcon);
607
iSnapAction[1]->addTo(iSnapTools);
341
iSnapAction[1]->setShortcut(Key("Snap|Boundary"));
342
iSnapAction[1]->setIcon(snapBdIcon);
609
344
iSnapAction[2] = new QAction(iSnapActionGroup);
610
345
iSnapAction[2]->setText(tr("Snap to intersection"));
611
iSnapAction[2]->setAccel(Key("F6", "Snap|Intersections"));
612
iSnapAction[2]->setIconSet(snapIntIcon);
613
iSnapAction[2]->addTo(iSnapTools);
615
iSnapTools->addSeparator();
346
iSnapAction[2]->setShortcut(Key("Snap|Intersections"));
347
iSnapAction[2]->setIcon(snapIntIcon);
617
349
iSnapAction[3] = new QAction(iSnapActionGroup);
618
350
iSnapAction[3]->setText(tr("Snap to grid"));
619
iSnapAction[3]->setAccel(Key("F7", "Snap|Grid"));
620
iSnapAction[3]->setIconSet(snapGridIcon);
621
iSnapAction[3]->addTo(iSnapTools);
623
iGridSizeStack = new QWidgetStack(iSnapTools);
624
QToolTip::add(iGridSizeStack, tr("Grid size"));
625
QWhatsThis::add(iGridSizeStack, tr(gridSizeText));
626
iGridSize = new QComboBox(false);
351
iSnapAction[3]->setShortcut(Key("Snap|Grid"));
352
iSnapAction[3]->setIcon(snapGridIcon);
354
iSnapAction[4] = new QAction(iSnapActionGroup);
355
iSnapAction[4]->setText(tr("Angular snap"));
356
iSnapAction[4]->setShortcut(Key("Snap|Angular"));
357
iSnapAction[4]->setIcon(snapAngleIcon);
359
iSnapAction[5] = new QAction(iSnapActionGroup);
360
iSnapAction[5]->setText(tr("Automatic angular snap"));
361
iSnapAction[5]->setShortcut(Key("Snap|Automatic angular"));
362
iSnapAction[5]->setIcon(snapAutoIcon);
364
iGridSizeStack = new QStackedWidget(iSnapTools);
365
iGridSizeStack->setToolTip(tr("Grid size"));
366
iGridSizeStack->setWhatsThis(tr(gridSizeText));
367
iGridSize = new QComboBox();
627
368
connect(iGridSize, SIGNAL(activated(int)),
628
369
SLOT(GridSizeChanged(int)));
629
iAbsGridSize = new IpeSpinBox(0, 0, 4, 100, 2);
370
iAbsGridSize = new IpeSpinBox(0, 4, 100, 2);
630
371
connect(iAbsGridSize, SIGNAL(valueChanged(int)),
631
372
SLOT(AbsGridSizeChanged(int)));
632
iGridSizeStack->addWidget(iGridSize, 0);
633
iGridSizeStack->addWidget(iAbsGridSize, 1);
635
iSnapTools->addSeparator();
637
iSnapAction[4] = new QAction(iSnapActionGroup);
638
iSnapAction[4]->setText(tr("Angular snap"));
639
iSnapAction[4]->setAccel(Key("F8", "Snap|Angular"));
640
iSnapAction[4]->setIconSet(snapAngleIcon);
641
iSnapAction[4]->addTo(iSnapTools);
643
iSnapAction[5] = new QAction(iSnapActionGroup);
644
iSnapAction[5]->setText(tr("Automatic angular snap"));
645
iSnapAction[5]->setAccel(Key("F9", "Snap|Automatic angular"));
646
iSnapAction[5]->setIconSet(snapAutoIcon);
647
iSnapAction[5]->addTo(iSnapTools);
649
iAngleSizeStack = new QWidgetStack(iSnapTools);
650
QToolTip::add(iAngleSizeStack, tr("Angular snapping angle"));
651
QWhatsThis::add(iAngleSizeStack, tr(angleSizeText));
652
iAngleSize = new QComboBox(false);
373
iGridSize->installEventFilter(this);
374
iAbsGridSize->installEventFilter(this);
375
iGridSizeStack->addWidget(iGridSize);
376
iGridSizeStack->addWidget(iAbsGridSize);
378
iAngleSizeStack = new QStackedWidget(iSnapTools);
379
iAngleSizeStack->setToolTip(tr("Angular snapping angle"));
380
iAngleSizeStack->setWhatsThis(tr(angleSizeText));
381
iAngleSize = new QComboBox();
653
382
connect(iAngleSize, SIGNAL(activated(int)),
654
383
SLOT(AngleSizeChanged(int)));
655
384
iAbsAngleSize = new DecimalSpinBox(3000, 360000, 2000);
656
385
connect(iAbsAngleSize, SIGNAL(valueChanged(int)),
657
386
SLOT(AbsAngleSizeChanged(int)));
658
iAngleSizeStack->addWidget(iAngleSize, 0);
659
iAngleSizeStack->addWidget(iAbsAngleSize, 1);
387
iAngleSize->installEventFilter(this);
388
iAbsAngleSize->installEventFilter(this);
389
iAngleSizeStack->addWidget(iAngleSize);
390
iAngleSizeStack->addWidget(iAbsAngleSize);
392
iSnapTools->addAction(iSnapAction[0]);
393
iSnapTools->addAction(iSnapAction[1]);
394
iSnapTools->addAction(iSnapAction[2]);
395
iSnapTools->addSeparator();
396
iSnapTools->addAction(iSnapAction[3]);
397
iSnapTools->addWidget(iGridSizeStack);
398
iSnapTools->addSeparator();
399
iSnapTools->addAction(iSnapAction[4]);
400
iSnapTools->addAction(iSnapAction[5]);
401
iSnapTools->addWidget(iAngleSizeStack);
403
iSnapActionGroup->setExclusive(false);
661
405
for (int i = 0; i < 6; ++i) {
662
iSnapAction[i]->setToggleAction(true);
406
iSnapAction[i]->setCheckable(true);
663
407
iSnapAction[i]->setWhatsThis(tr(snapText));
664
408
connect(iSnapAction[i], SIGNAL(toggled(bool)),
665
409
this, SLOT(SnapChanged(bool)));
668
// ------------------------------------------------------------
669
// Bookmark and layer toolbar
670
// ------------------------------------------------------------
672
iBookmarkTools = new QToolBar(tr("Bookmark tools"), this,
673
QMainWindow::Right, false, "bookmark tools");
675
iBookmarks = new QListView(iLayerTools, "bookmarks");
676
QToolTip::add(iBookmarks, tr("Bookmarks of this document"));
677
iBookmarks->addColumn("Section");
678
iBookmarks->setSorting(-1); // don't resort
679
iBookmarks->header()->hide();
680
iBookmarks->setRootIsDecorated(true);
682
iBookmarks = new QListBox(iBookmarkTools, "bookmarks");
683
QToolTip::add(iBookmarks, tr("Bookmarks of this document"));
684
iBookmarks->setFocusPolicy(NoFocus);
685
connect(iBookmarks, SIGNAL(selected(int)),
686
this, SLOT(BookmarkSelected(int)));
689
iLayerTools = new QToolBar(tr("Layer tools"), this,
690
QMainWindow::Left, false, "layer tools");
691
iLayerTools->setVerticalStretchable(true);
692
iLayerList = new LayerBox(iLayerTools, "layer list box");
693
iLayerList->setSelectionMode(QListBox::Multi);
694
iLayerList->setFocusPolicy(NoFocus);
695
QToolTip::add(iLayerList, tr("Layers of this page"));
696
QWhatsThis::add(iLayerList, tr(layerListText));
698
QLabel *penguins = new QLabel(iLayerTools);
699
penguins->setPixmap(penguinIcon(iLayerList->sizeHint().width()));
700
QWhatsThis::add(penguins, tr(penguinText));
702
iLayerTools->setStretchableWidget(iLayerList);
703
iBookmarkTools->setStretchableWidget(iBookmarks);
704
iBookmarks->setMinimumWidth(iLayerList->sizeHint().width());
706
iMouse = new QLabel(statusBar());
707
statusBar()->addWidget(iMouse, 0, true);
709
412
// --------------------------------------------------------------------
710
413
// Object creators tool bar
711
414
// --------------------------------------------------------------------
713
iObjectTools = new QToolBar(this, "mode tools");
714
iObjectTools->setLabel(tr("Mode tools"));
716
416
iModeActionGroup = new QActionGroup(this);
717
connect(iModeActionGroup, SIGNAL(selected(QAction*)),
417
connect(iModeActionGroup, SIGNAL(triggered(QAction*)),
718
418
SLOT(SetCreator(QAction*)));
720
420
for (int i = 0; i < IpeOverlayFactory::Num; ++i) {
721
421
QPixmap icon = ipeIcon(IpeOverlayFactory::PixmapName(i));
722
422
iModeAction[i] = new QAction(iModeActionGroup);
723
423
iModeAction[i]->setText(IpeOverlayFactory::Tooltip(i));
724
iModeAction[i]->setIconSet(icon);
725
iModeAction[i]->setWhatsThis(tr(IpeOverlayFactory::WhatsThis(i)));
726
iModeAction[i]->setAccel(Key(IpeOverlayFactory::Shortcut(i),
727
IpeOverlayFactory::Context(i)));
728
iModeAction[i]->setToggleAction(true);
729
iModeAction[i]->addTo(iObjectTools);
424
iModeAction[i]->setIcon(icon);
425
iModeAction[i]->setWhatsThis(IpeOverlayFactory::WhatsThis(i));
426
iModeAction[i]->setShortcut(Key(IpeOverlayFactory::Context(i)));
427
iModeAction[i]->setCheckable(true);
428
iObjectTools->addAction(iModeAction[i]);
731
430
iObjectTools->addSeparator();
734
// ------------------------------------------------------------
736
// ------------------------------------------------------------
738
QMenuBar* menu = menuBar();
741
iFileMenu = new QPopupMenu;
742
iFileMenu->insertItem(tr("New &Window"), this, SLOT(NewWindow()),
743
Key("none", "File|New Window"));
745
id = iFileMenu->insertItem(newIcon, tr("&New"), this, SLOT(NewDoc()),
746
Key("Ctrl+N", "File|New"));
747
iFileMenu->setWhatsThis(id, fileNewText );
749
id = iFileMenu->insertItem(openIcon, tr("&Open"),
751
Key("Ctrl+O", "File|Open"));
752
iFileMenu->setWhatsThis(id, fileOpenText );
754
id = iFileMenu->insertItem(saveIcon, tr("&Save"), this, SLOT(Save()),
755
Key("Ctrl+S", "File|Save"));
756
iFileMenu->setWhatsThis(id, fileSaveText );
758
id = iFileMenu->insertItem(tr("Save &as..."), this, SLOT(SaveAs()),
759
Key("none", "File|Save as"));
760
iFileMenu->setWhatsThis(id, fileSaveText );
762
iFileMenu->insertItem(tr("Save as &bitmap"), this, SLOT(SaveAsBitmap()),
763
Key("none", "File|Save as bitmap"));
764
iFileMenu->insertSeparator();
766
iFileMenu->insertItem(tr("Run &Latex"), this, SLOT(RunLatex(int)),
767
Key("Ctrl+L", "File|Run Latex"), 1);
768
iFileMenu->insertSeparator();
770
iFileMenu->insertItem(tr("&Close"), this, SLOT(close()),
771
Key("Ctrl+Q", "File|Close"));
772
iFileMenu->insertItem(tr("E&xit"), qApp, SLOT(closeAllWindows()),
773
Key("none", "File|Exit"));
774
menu->insertItem(tr("&File"), iFileMenu);
776
iEditMenu = new QPopupMenu;
777
iEditMenu->insertItem(tr("&Absolute attributes"),
778
this, SLOT(AbsoluteAttributes()),
779
Key("Ctrl+T", "Edit|Absolute attributes"),
780
EAbsoluteAttributesMenuId);
781
iEditMenu->insertSeparator();
782
iEditMenu->insertItem(undoIcon, tr("&Undo"),
783
this, SLOT(UndoCmd(int)),
784
Key("Ctrl+Z", "Edit|Undo"), ECmdUndo);
785
iEditMenu->insertItem(redoIcon, tr("&Redo"),
786
this, SLOT(UndoCmd(int)),
787
Key("Ctrl+Y", "Edit|Redo"), ECmdRedo);
788
iEditMenu->insertSeparator();
789
iEditMenu->insertItem(cutIcon, tr("Cu&t"),
790
this, SLOT(Cmd(int)),
791
Key("Ctrl+X", "Edit|Cut"), ECmdCut);
792
iEditMenu->insertItem(copyIcon, tr("&Copy"),
793
this, SLOT(Cmd(int)),
794
Key("Ctrl+C", "Edit|Copy"), ECmdCopy);
795
iEditMenu->insertItem(pasteIcon, tr("&Paste"),
796
this, SLOT(Cmd(int)),
797
Key("Ctrl+V", "Edit|Paste"), ECmdPaste);
798
iEditMenu->insertItem(tr("&Delete"),
799
this, SLOT(Cmd(int)),
800
Key("Del", "Edit|Delete"), ECmdDelete);
801
iEditMenu->insertSeparator();
802
iEditMenu->insertItem(tr("&Group"), this, SLOT(Cmd(int)),
803
Key("Ctrl+G", "Edit|Group"), ECmdGroup);
804
iEditMenu->insertItem(tr("&Ungroup"), this, SLOT(Cmd(int)),
805
Key("Ctrl+U", "Edit|Ungroup"), ECmdUngroup);
806
iEditMenu->insertItem(tr("&Front"), this, SLOT(Cmd(int)),
807
Key("Ctrl+F", "Edit|Front"), ECmdFront);
808
iEditMenu->insertItem(tr("&Back"), this, SLOT(Cmd(int)),
809
Key("Ctrl+B", "Edit|Back"), ECmdBack);
810
iEditMenu->insertItem(tr("&Duplicate"),
811
this, SLOT(Cmd(int)),
812
Key("d", "Edit|Duplicate"), ECmdDuplicate);
813
iEditMenu->insertItem(tr("Select &all"), this, SLOT(Cmd(int)),
814
Key("Ctrl+A", "Edit|Select all"), ECmdSelectAll);
815
iEditMenu->insertSeparator();
816
iEditMenu->insertItem(tr("Co&mpose paths"), this, SLOT(Cmd(int)),
817
Key("none", "Edit|Compose paths"), ECmdComposePaths);
818
iEditMenu->insertItem(tr("&Join paths"), this, SLOT(Cmd(int)),
819
Key("Ctrl+J", "Edit|Join paths"), ECmdJoinPaths);
820
//iEditMenu->insertItem(tr("Dec&ompose path"), this, SLOT(Cmd(int)),
821
//Key_O, ECmdDecomposePath);
822
iEditMenu->insertSeparator();
823
iEditMenu->insertItem(tr("Insert text box"), this, SLOT(InsertTextBox()),
824
Key("F10", "Edit|Insert text box"));
825
iEditMenu->insertItem(tr("Insert item box"), this, SLOT(InsertItemBox()),
826
Key("Shift+F10", "Edit|Insert text box"));
827
iEditMenu->insertItem(tr("Edit object"), this, SLOT(EditObject()),
828
Key("Ctrl+E", "Edit|Edit"), ECmdEdit);
829
iEditMenu->insertSeparator();
830
iEditMenu->insertItem(tr("D&ocument properties"),
831
this, SLOT(EditDocProps()),
832
Key("Ctrl+Shift+P", "Edit|Document properties"));
833
iEditMenu->insertItem(tr("St&yle sheets"), this, SLOT(StyleSheets()),
834
Key("Ctrl+Shift+S", "Edit|Style sheets"));
835
connect(iEditMenu, SIGNAL(aboutToShow()),
836
this, SLOT(AboutToShowEditMenu()));
837
menu->insertItem(tr("&Edit"), iEditMenu);
839
iModeMenu = new QPopupMenu;
432
iModeActionGroup->setExclusive(true);
434
// --------------------------------------------------------------------
436
// --------------------------------------------------------------------
438
QWidget *prop = new QWidget;
439
QGridLayout *layout = new QGridLayout(prop);
440
prop->setLayout(layout);
442
iStrokeColorStack = new QStackedWidget();
443
iStrokeColorStack->setToolTip(tr("Stroke color"));
444
iStrokeColorStack->setWhatsThis(tr(strokeColorText));
445
iStrokeColor = new QComboBox();
446
connect(iStrokeColor, SIGNAL(activated(int)),
447
SLOT(SetStrokeColorName(int)));
448
iAbsStrokeColor = new QPushButton();
449
// iStrokeColorStack->setMaximumHeight(iStrokeColor->sizeHint().height());
450
connect(iAbsStrokeColor, SIGNAL(clicked()),
451
this, SLOT(SetStrokeColor()));
452
iStrokeColor->installEventFilter(this);
453
iAbsStrokeColor->installEventFilter(this);
454
iStrokeColorStack->addWidget(iStrokeColor);
455
iStrokeColorStack->addWidget(iAbsStrokeColor);
457
iFillColorStack = new QStackedWidget();
458
iFillColorStack->setToolTip(tr("Fill color"));
459
iFillColorStack->setWhatsThis(tr(fillColorText));
460
iFillColor = new QComboBox();
461
connect(iFillColor, SIGNAL(activated(int)),
462
SLOT(SetFillColorName(int)));
463
iAbsFillColor = new QPushButton();
464
// iFillColorStack->setMaximumHeight(iFillColor->sizeHint().height());
465
connect(iAbsFillColor, SIGNAL(clicked()),
466
this, SLOT(SetFillColor()));
467
iFillColor->installEventFilter(this);
468
iAbsFillColor->installEventFilter(this);
469
iFillColorStack->addWidget(iFillColor);
470
iFillColorStack->addWidget(iAbsFillColor);
472
layout->addWidget(iStrokeColorStack, 0, 0);
473
layout->addWidget(iFillColorStack, 0, 1);
474
layout->setRowMinimumHeight(0, iStrokeColor->sizeHint().height());
476
// --------------------------------------------------------------------
478
iLineWidthStack = new QStackedWidget();
479
iLineWidthStack->setToolTip(tr("Line width"));
480
iLineWidthStack->setWhatsThis(tr(lineWidthText));
481
iLineWidth = new QComboBox();
482
connect(iLineWidth, SIGNAL(activated(int)),
483
SLOT(LineWidthChanged(int)));
484
iAbsLineWidth = new DecimalSpinBox(0, 10000, 200);
485
connect(iAbsLineWidth, SIGNAL(valueChanged(int)),
486
SLOT(AbsLineWidthChanged(int)));
487
iLineWidth->installEventFilter(this);
488
iAbsLineWidth->installEventFilter(this);
489
iLineWidthStack->addWidget(iLineWidth);
490
iLineWidthStack->addWidget(iAbsLineWidth);
492
iDashStyle = new QComboBox();
493
iDashStyle->setToolTip(tr("Line dash pattern"));
494
iDashStyle->setWhatsThis(tr(lineDashText));
495
connect(iDashStyle, SIGNAL(activated(int)),
496
SLOT(DashStyleChanged(int)));
497
iDashStyle->installEventFilter(this);
499
iArrowSizeStack = new QStackedWidget();
500
iArrowSizeStack->setToolTip(tr("Arrow size"));
501
iArrowSizeStack->setWhatsThis(tr(arrowSizeText));
502
iArrowSize = new QComboBox();
503
connect(iArrowSize, SIGNAL(activated(int)),
504
SLOT(ArrowSizeChanged(int)));
505
iAbsArrowSize = new DecimalSpinBox(200, 100000, 1000);
506
connect(iAbsArrowSize, SIGNAL(valueChanged(int)),
507
SLOT(AbsArrowSizeChanged(int)));
508
iArrowSize->installEventFilter(this);
509
iAbsArrowSize->installEventFilter(this);
510
iArrowSizeStack->addWidget(iArrowSize);
511
iArrowSizeStack->addWidget(iAbsArrowSize);
513
QPixmap arrowIconRight = ipeIcon("arrowRight");
514
QPixmap arrowIconLeft = ipeIcon("arrowLeft");
515
QPixmap arrowIconMid = ipeIcon("arrowMid");
517
iBackwardArrow = new ArrowButton();
518
iBackwardArrow->setArrow(arrowIconLeft);
519
iBackwardArrow->setToolTip(tr("Backward arrow"));
520
iBackwardArrow->setWhatsThis(tr(arrowText));
521
iBackwardArrow->setFocusPolicy(Qt::NoFocus);
523
QLabel *midArrow = new QLabel();
524
midArrow->setPixmap(arrowIconMid);
525
midArrow->setAlignment(Qt::AlignCenter);
527
iForwardArrow = new ArrowButton();
528
iForwardArrow->setArrow(arrowIconRight);
529
iForwardArrow->setToolTip(tr("Forward arrow"));
530
iForwardArrow->setWhatsThis(tr(arrowText));
531
iForwardArrow->setFocusPolicy(Qt::NoFocus);
533
connect(iBackwardArrow, SIGNAL(toggled(bool)),
534
this, SLOT(ArrowChanged(bool)));
535
connect(iForwardArrow, SIGNAL(toggled(bool)),
536
this, SLOT(ArrowChanged(bool)));
538
iAttributes.iForwardArrow = false;
539
iAttributes.iBackwardArrow = false;
541
QHBoxLayout *arrowLayout = new QHBoxLayout();
542
arrowLayout->addStretch(100);
543
arrowLayout->addWidget(iBackwardArrow);
544
arrowLayout->addWidget(midArrow);
545
arrowLayout->addWidget(iForwardArrow);
546
arrowLayout->addStretch(100);
548
layout->addWidget(iLineWidthStack, 1, 0);
549
layout->addWidget(iDashStyle, 1, 1);
550
layout->addLayout(arrowLayout, 2, 0);
551
layout->addWidget(iArrowSizeStack, 2, 1);
553
// --------------------------------------------------------------------
555
QPixmap markIcon = ipeIcon("marks");
557
iMarkShape = new QComboBox();
558
iMarkShape->setToolTip(tr("Mark shape"));
559
iMarkShape->setWhatsThis(tr(markShapeText));
560
connect(iMarkShape, SIGNAL(activated(int)), SLOT(MarkShapeChanged(int)));
561
iMarkShape->addItem(markIcon, tr("Circle"));
562
iMarkShape->addItem(markIcon, tr("Disc"));
563
iMarkShape->addItem(markIcon, tr("Box"));
564
iMarkShape->addItem(markIcon, tr("Square"));
565
iMarkShape->addItem(markIcon, tr("Cross"));
566
iMarkShape->setCurrentIndex(1);
567
iAttributes.iMarkShape = iMarkShape->currentIndex() + 1;
568
iMarkShape->installEventFilter(this);
570
iMarkSizeStack = new QStackedWidget();
571
iMarkSizeStack->setToolTip(tr("Mark size"));
572
iMarkSizeStack->setWhatsThis(tr(markSizeText));
573
iMarkSize = new QComboBox();
574
connect(iMarkSize, SIGNAL(activated(int)),
575
SLOT(MarkSizeChanged(int)));
576
iAbsMarkSize = new DecimalSpinBox(200, 100000, 1000);
577
connect(iAbsMarkSize, SIGNAL(valueChanged(int)),
578
SLOT(AbsMarkSizeChanged(int)));
579
iMarkSize->installEventFilter(this);
580
iAbsMarkSize->installEventFilter(this);
581
iMarkSizeStack->addWidget(iMarkSize);
582
iMarkSizeStack->addWidget(iAbsMarkSize);
584
iTextSizeStack = new QStackedWidget();
585
iTextSizeStack->setToolTip(tr("Font size"));
586
iTextSizeStack->setWhatsThis(tr(textSizeText));
587
iTextSize = new QComboBox();
588
connect(iTextSize, SIGNAL(activated(int)),
589
SLOT(TextSizeChanged(int)));
590
iAbsTextSize = new DecimalSpinBox(4000, 50000, 1000);
591
connect(iAbsTextSize, SIGNAL(valueChanged(int)),
592
SLOT(AbsTextSizeChanged(int)));
593
iTextSize->installEventFilter(this);
594
iAbsTextSize->installEventFilter(this);
595
iTextSizeStack->addWidget(iTextSize);
596
iTextSizeStack->addWidget(iAbsTextSize);
598
layout->addWidget(iMarkShape, 3, 0);
599
layout->addWidget(iMarkSizeStack, 3, 1);
600
layout->addWidget(iTextSizeStack, 4, 0);
602
QToolButton *ab = new QToolButton();
603
ab->setFocusPolicy(Qt::NoFocus);
604
connect(ab, SIGNAL(clicked()),
605
this, SLOT(ToggleAbsoluteAttributes()));
607
QHBoxLayout *abLayout = new QHBoxLayout();
608
abLayout->addStretch(100);
609
abLayout->addWidget(ab);
611
layout->addLayout(abLayout, 4, 1);
613
layout->setRowStretch(5, 1);
615
iPropertiesTools->setWidget(prop);
617
// ------------------------------------------------------------
618
// Bookmark and layer windows
619
// ------------------------------------------------------------
621
iBookmarks = new QListWidget();
622
iBookmarks->setToolTip(tr("Bookmarks of this document"));
623
iBookmarks->setFocusPolicy(Qt::NoFocus);
624
connect(iBookmarks, SIGNAL(itemActivated(QListWidgetItem *)),
625
this, SLOT(BookmarkSelected(QListWidgetItem *)));
626
iBookmarkTools->setWidget(iBookmarks);
628
iLayerList = new LayerBox();
629
iLayerList->setFocusPolicy(Qt::NoFocus);
630
iLayerList->setToolTip(tr("Layers of this page"));
631
iLayerList->setWhatsThis(tr(layerListText));
632
iLayerTools->setWidget(iLayerList);
634
// QLabel *penguins = new QLabel();
635
// penguins->setPixmap(penguinIcon(iLayerList->sizeHint().width()));
636
// penguins->setWhatsThis(tr(penguinText));
638
// ------------------------------------------------------------
640
// ------------------------------------------------------------
642
QAction *newWinAct = new QAction(tr("New &Window"), this);
643
newWinAct->setShortcut(Key("File|New Window"));
644
connect(newWinAct, SIGNAL(triggered()), SLOT(NewWindow()));
646
QAction *saveAsAct = new QAction(tr("Save &as..."), this);
647
saveAsAct->setShortcut(Key("File|Save as"));
648
saveAsAct->setWhatsThis(tr(fileSaveText));
649
connect(saveAsAct, SIGNAL(triggered()), SLOT(SaveAs()));
651
QAction *saveAsBitmapAct = new QAction(tr("Save as &bitmap"), this);
652
saveAsBitmapAct->setShortcut(Key("File|Save as bitmap"));
653
connect(saveAsBitmapAct, SIGNAL(triggered()), SLOT(SaveAsBitmap()));
655
QAction *runLatexAct = new QAction(tr("Run &Latex"), this);
656
runLatexAct->setShortcut(Key("File|Run Latex"));
657
connect(runLatexAct, SIGNAL(triggered()), SLOT(RunLatex()));
659
QAction *closeAct = new QAction(tr("&Close"), this);
660
closeAct->setShortcut(Key("File|Close"));
661
connect(closeAct, SIGNAL(triggered()), SLOT(close()));
663
QAction *exitAct = new QAction(tr("E&xit"), this);
664
exitAct->setShortcut(Key("File|Exit"));
665
connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
667
iFileMenu->addAction(newWinAct);
668
iFileMenu->addAction(newAct);
669
iFileMenu->addAction(openAct);
670
iFileMenu->addAction(saveAct);
671
iFileMenu->addAction(saveAsAct);
672
iFileMenu->addAction(saveAsBitmapAct);
673
iFileMenu->addSeparator();
674
iFileMenu->addAction(runLatexAct);
675
iFileMenu->addSeparator();
676
iFileMenu->addAction(closeAct);
677
iFileMenu->addAction(exitAct);
679
// ------------------------------------------------------------
681
// ------------------------------------------------------------
683
iAbsoluteAttributesAction = new QAction(tr("&Absolute attributes"), this);
684
iAbsoluteAttributesAction->setShortcut(Key(
685
"Edit|Absolute attributes"));
686
iAbsoluteAttributesAction->setCheckable(true);
687
connect(iAbsoluteAttributesAction, SIGNAL(toggled(bool)),
688
SLOT(AbsoluteAttributes(bool)));
690
iUndoAction = new IpeAction(ECmdUndo, undoIcon, tr("&Undo"), this);
691
iUndoAction->setShortcut(Key("Edit|Undo"));
692
connect(iUndoAction, SIGNAL(triggered(int)), SLOT(UndoCmd(int)));
694
iRedoAction = new IpeAction(ECmdRedo, redoIcon, tr("&Redo"), this);
695
iRedoAction->setShortcut(Key("Edit|Redo"));
696
connect(iRedoAction, SIGNAL(triggered(int)), SLOT(UndoCmd(int)));
698
iDeleteAction = new IpeAction(ECmdDelete, tr("&Delete"), this);
699
iDeleteAction->setShortcut(Key("Edit|Delete"));
700
connect(iDeleteAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
702
iGroupAction = new IpeAction(ECmdGroup, tr("&Group"), this);
703
iGroupAction->setShortcut(Key("Edit|Group"));
704
connect(iGroupAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
706
iUngroupAction = new IpeAction(ECmdUngroup, tr("Ungroup"), this);
707
iUngroupAction->setShortcut(Key("Edit|Ungroup"));
708
connect(iUngroupAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
710
iFrontAction = new IpeAction(ECmdFront, tr("&Front"), this);
711
iFrontAction->setShortcut(Key("Edit|Front"));
712
connect(iFrontAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
714
iBackAction = new IpeAction(ECmdBack, tr("&Back"), this);
715
iBackAction->setShortcut(Key("Edit|Back"));
716
connect(iBackAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
718
QAction *forwardAction = new IpeAction(ECmdForward, tr("Forward"), this);
719
forwardAction->setShortcut(Key("Edit|Forward"));
720
connect(forwardAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
722
QAction *backwardAction = new IpeAction(ECmdBackward, tr("Backward"), this);
723
backwardAction->setShortcut(Key("Edit|Backward"));
724
connect(backwardAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
726
QAction *beforeAction = new IpeAction(ECmdBefore, tr("Just before"), this);
727
beforeAction->setShortcut(Key("Edit|Before"));
728
connect(beforeAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
730
QAction *behindAction = new IpeAction(ECmdBehind, tr("Just behind"), this);
731
behindAction->setShortcut(Key("Edit|Behind"));
732
connect(behindAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
734
iDuplicateAction = new IpeAction(ECmdDuplicate, tr("&Duplicate"), this);
735
iDuplicateAction->setShortcut(Key("Edit|Duplicate"));
736
connect(iDuplicateAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
738
QAction *selectAllAct = new IpeAction(ECmdSelectAll,
739
tr("Select &all"), this);
740
selectAllAct->setShortcut(Key("Edit|Select all"));
741
connect(selectAllAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
743
iComposeAction = new IpeAction(ECmdComposePaths, tr("Co&mpose paths"), this);
744
iComposeAction->setShortcut(Key("Edit|Compose paths"));
745
connect(iComposeAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
747
iJoinAction = new IpeAction(ECmdJoinPaths, tr("&Join paths"), this);
748
iJoinAction->setShortcut(Key("Edit|Join paths"));
749
connect(iJoinAction, SIGNAL(triggered(int)), SLOT(Cmd(int)));
751
QAction *insertTextBoxAct = new QAction(tr("Insert text box"), this);
752
insertTextBoxAct->setShortcut(Key("Edit|Insert text box"));
753
connect(insertTextBoxAct, SIGNAL(triggered()), SLOT(InsertTextBox()));
755
QAction *editObjectAct = new QAction(tr("Edit object"), this);
756
editObjectAct->setShortcut(Key("Edit|Edit"));
757
connect(editObjectAct, SIGNAL(triggered()), SLOT(EditObject()));
759
QAction *docPropsAct = new QAction(tr("D&ocument properties"), this);
760
docPropsAct->setShortcut(Key("Edit|Document properties"));
761
connect(docPropsAct, SIGNAL(triggered()), SLOT(EditDocProps()));
763
QAction *styleSheetsAct = new QAction(tr("St&yle sheets"), this);
764
styleSheetsAct->setShortcut(Key("Edit|Style sheets"));
765
connect(styleSheetsAct, SIGNAL(triggered()), SLOT(StyleSheets()));
767
QAction *updateStylesAct = new QAction(tr("Update style sheets"), this);
768
updateStylesAct->setShortcut(Key("Edit|Update style sheets"));
769
connect(updateStylesAct, SIGNAL(triggered()), SLOT(UpdateStyleSheets()));
771
iEditMenu->addAction(iAbsoluteAttributesAction);
772
iEditMenu->addSeparator();
773
iEditMenu->addAction(iUndoAction);
774
iEditMenu->addAction(iRedoAction);
775
iEditMenu->addSeparator();
776
iEditMenu->addAction(iCutAction);
777
iEditMenu->addAction(iCopyAction);
778
iEditMenu->addAction(pasteAct);
779
iEditMenu->addAction(iDeleteAction);
780
iEditMenu->addSeparator();
781
iEditMenu->addAction(iGroupAction);
782
iEditMenu->addAction(iUngroupAction);
783
iEditMenu->addAction(iFrontAction);
784
iEditMenu->addAction(iBackAction);
785
iEditMenu->addAction(forwardAction);
786
iEditMenu->addAction(backwardAction);
787
iEditMenu->addAction(beforeAction);
788
iEditMenu->addAction(behindAction);
789
iEditMenu->addAction(iDuplicateAction);
790
iEditMenu->addAction(selectAllAct);
791
iEditMenu->addSeparator();
792
iEditMenu->addAction(iComposeAction);
793
iEditMenu->addAction(iJoinAction);
794
iEditMenu->addSeparator();
795
iEditMenu->addAction(insertTextBoxAct);
796
iEditMenu->addAction(editObjectAct);
797
iEditMenu->addSeparator();
798
iEditMenu->addAction(docPropsAct);
799
iEditMenu->addAction(styleSheetsAct);
800
iEditMenu->addAction(updateStylesAct);
802
connect(iEditMenu, SIGNAL(aboutToShow()), SLOT(AboutToShowEditMenu()));
804
// --------------------------------------------------------------------
805
// Object (Mode) menu
806
// --------------------------------------------------------------------
840
808
for (int i = 0; i < IpeOverlayFactory::Num; ++i)
841
iModeAction[i]->addTo(iModeMenu);
843
menu->insertItem(tr("&Mode"), iModeMenu);
845
iSnapMenu = new QPopupMenu;
846
iSnapMenu->insertItem(tr("&Absolute grid/angle size"),
847
this, SLOT(AbsoluteSnapping()),
848
Key("Ctrl+Shift+T", "Snap|Absolute"),
849
EAbsoluteSnappingMenuId);
850
iSnapMenu->insertSeparator();
851
iSnapActionGroup->addTo(iSnapMenu);
852
iSnapMenu->insertSeparator();
853
iSnapMenu->insertItem(tr("Set origin"), this,
855
Key("F1", "Snap|Set origin"), ECmdSetOrigin);
856
iSnapMenu->insertItem(tr("Set origin && snap"), this,
858
Key("none", "Snap|Set origin & snap"),
860
iSnapMenu->insertItem(tr("Hide axes"), this,
862
Key("Shift+F1", "Snap|Hide axes"), ECmdResetOrigin);
863
iSnapMenu->insertItem(tr("Set direction"), this,
865
Key("F2", "Snap|Set direction"), ECmdSetDirection);
866
iSnapMenu->insertItem(tr("Set line"), this,
868
Key("F3", "Snap|Set line"), ECmdSetLine);
869
iSnapMenu->insertItem(tr("Set line && snap"), this,
871
Key("Shift+F3", "Snap|Set line & snap"),
873
menu->insertItem(tr("&Snap"), iSnapMenu, ESnapMenuId);
875
iZoomMenu = new QPopupMenu;
876
iZoomMenu->insertItem(tr("&Grid visible"),
877
this, SLOT(GridVisible()),
878
Key("F12", "Zoom|Grid"),
880
iZoomMenu->insertItem(tr("&Coordinates visible"),
881
this, SLOT(CoordinatesVisible()),
882
Key("Shift+F12", "Zoom|Coordinates"),
883
ECoordinatesVisibleMenuId);
884
iZoomMenu->insertSeparator();
885
iZoomMenu->insertItem(tr("Zoom &in"), iResolution, SLOT(stepUp()),
886
Key("Ctrl+PgUp", "Zoom|Zoom in"));
887
iZoomMenu->insertItem(tr("Zoom &out"), iResolution, SLOT(stepDown()),
888
Key("Ctrl+PgDown", "Zoom|Zoom out"));
889
iZoomMenu->insertItem(tr("&Normal size"), this, SLOT(NormalSize()),
890
Key("/", "Zoom|Normal size"));
891
iZoomMenu->insertItem(tr("Fit &page"), this, SLOT(FitPage()),
892
Key("\\", "Zoom|Fit page"));
893
iZoomMenu->insertItem(tr("&Fit objects"),
894
this, SLOT(FitObjects()),
895
Key("=", "Zoom|Fit objects"));
896
iZoomMenu->insertItem(tr("Fit &selection"),
897
this, SLOT(FitSelection()),
898
Key("F11", "Zoom|Fit selection"));
899
iZoomMenu->insertSeparator();
900
iZoomMenu->insertItem(tr("Pan &here"), this,
902
Key("x", "view|Pan here"), ECmdHere);
903
menu->insertItem(tr("&Zoom"), iZoomMenu, EZoomMenuId);
905
iLayerMenu = new QPopupMenu;
906
iLayerMenu->insertItem(tr("&New layer"), this, SLOT(Cmd(int)),
907
Key("Ctrl+Shift+N", "Layers|New"),
909
iLayerMenu->insertItem(tr("&Rename layer"), this, SLOT(Cmd(int)),
910
Key("Ctrl+Shift+R", "Layers|Rename"),
912
iLayerMenu->insertSeparator();
913
iLayerMenu->insertItem(tr("&Select all in layer"),
914
this, SLOT(Cmd(int)),
915
Key("Ctrl+Shift+A", "Layers|Select all"),
917
iLayerMenu->insertItem(tr("&Move objects to layer"),
918
this, SLOT(Cmd(int)),
919
Key("Ctrl+Shift+M", "Layers|Move objects"),
921
menu->insertItem(tr("&Layers"), iLayerMenu);
923
iViewMenu = new QPopupMenu;
924
iViewMenu->insertItem(tr("Next vie&w"), this, SLOT(NextView()),
925
Key("PgDown", "Views|Next view"));
926
iViewMenu->insertItem(tr("&Previous view"), this, SLOT(PreviousView()),
927
Key("PgUp", "Views|Previous view"));
928
iViewMenu->insertItem(tr("&First view"), this, SLOT(Cmd(int)),
929
Key("Home", "Views|First view"),
931
iViewMenu->insertItem(tr("&Last view"), this, SLOT(Cmd(int)),
932
Key("End", "Views|Last view"),
934
iViewMenu->insertSeparator();
935
iViewMenu->insertItem(tr("&New layer, new view"), this, SLOT(Cmd(int)),
936
Key("Ctrl+Shift+I", "Views|New layer, new view"),
937
ECmdNewLayerNewView);
938
iViewMenu->insertItem(tr("New &view"), this, SLOT(Cmd(int)),
939
Key("none", "Views|New view"),
941
iViewMenu->insertItem(tr("&Delete view"), this, SLOT(Cmd(int)),
942
Key("none", "Views|Delete view"),
944
iViewMenu->insertSeparator();
945
iViewMenu->insertItem(tr("&Edit views"), this,
947
Key("Ctrl+P", "Views|Edit views"));
948
menu->insertItem(tr("&Views"), iViewMenu);
950
iPageMenu = new QPopupMenu;
951
iPageMenu->insertItem(tr("&Next page"), iPageNumber, SLOT(stepUp()),
952
Key("Shift+PgDown", "Page|Next"));
953
iPageMenu->insertItem(tr("&Previous page"), iPageNumber, SLOT(stepDown()),
954
Key("Shift+PgUp", "Page|Previous"));
955
iPageMenu->insertItem(tr("&First page"), this, SLOT(FirstPage()),
956
Key("Shift+Home", "Page|First"));
957
iPageMenu->insertItem(tr("&Last page"), this, SLOT(LastPage()),
958
Key("Shift+End", "Page|Last"));
959
iPageMenu->insertSeparator();
960
iPageMenu->insertItem(tr("&Insert page"), this, SLOT(CreatePage()),
961
Key("Ctrl+I", "Page|Insert"));
962
iPageMenu->insertItem(tr("&Cut page"), this, SLOT(CopyPage(int)),
963
Key("Ctrl+Shift+X", "Page|Cut"), 1);
964
iPageMenu->insertItem(tr("Cop&y page"), this, SLOT(CopyPage(int)),
965
Key("Ctrl+Shift+C", "Page|Copy"), 0);
966
iPageMenu->insertItem(tr("P&aste page"), this, SLOT(PastePage()),
967
Key("Ctrl+Shift+V", "Page|Paste"));
968
iPageMenu->insertItem(tr("&Delete page"), this, SLOT(DeletePage()),
969
Key("none", "Page|Delete"));
970
menu->insertItem(tr("&Pages"), iPageMenu);
972
iIpeletMenu = new QPopupMenu;
809
iModeMenu->addAction(iModeAction[i]);
811
// --------------------------------------------------------------------
813
// --------------------------------------------------------------------
815
iAbsoluteSnapAction = new QAction(tr("&Absolute grid/angle size"), this);
816
iAbsoluteSnapAction->setShortcut(Key("Snap|Absolute"));
817
iAbsoluteSnapAction->setCheckable(true);
818
connect(iAbsoluteSnapAction, SIGNAL(toggled(bool)),
819
SLOT(AbsoluteSnapping(bool)));
821
QAction *setOriginAct = new IpeAction(ECmdSetOrigin, tr("Set origin"), this);
822
connect(setOriginAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
823
setOriginAct->setShortcut(Key("Snap|Set origin"));
825
QAction *setOriginSnapAct =
826
new IpeAction(ECmdSetOriginSnap, tr("Set origin && snap"), this);
827
setOriginSnapAct->setShortcut(Key("Snap|Set origin & snap"));
828
connect(setOriginSnapAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
830
QAction *hideAxesAct = new IpeAction(ECmdResetOrigin, tr("Hide axes"), this);
831
hideAxesAct->setShortcut(Key("Snap|Hide axes"));
832
connect(hideAxesAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
834
QAction *setDirectionAct =
835
new IpeAction(ECmdSetDirection, tr("Set direction"), this);
836
setDirectionAct->setShortcut(Key("Snap|Set direction"));
837
connect(setDirectionAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
839
QAction *resetDirectionAct =
840
new IpeAction(ECmdResetDirection, tr("Reset direction"), this);
841
resetDirectionAct->setShortcut(Key("Snap|Reset direction"));
842
connect(resetDirectionAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
844
QAction *setLineAct = new IpeAction(ECmdSetLine, tr("Set line"), this);
845
setLineAct->setShortcut(Key("Snap|Set line"));
846
connect(setLineAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
848
QAction *setLineSnapAct =
849
new IpeAction(ECmdSetLineSnap, tr("Set line && snap"), this);
850
setLineSnapAct->setShortcut(Key("Snap|Set line & snap"));
851
connect(setLineSnapAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
853
iSnapMenu->addAction(iAbsoluteSnapAction);
854
iSnapMenu->addSeparator();
855
for (int i = 0; i < 5; ++i)
856
iSnapMenu->addAction(iSnapAction[i]);
857
iSnapMenu->addSeparator();
858
// iSnapMenu->addAction(setOriginAct);
859
iSnapMenu->addAction(setOriginSnapAct);
860
iSnapMenu->addAction(hideAxesAct);
861
iSnapMenu->addAction(setDirectionAct);
862
iSnapMenu->addAction(resetDirectionAct);
863
iSnapMenu->addAction(setLineAct);
864
iSnapMenu->addAction(setLineSnapAct);
866
// --------------------------------------------------------------------
868
// --------------------------------------------------------------------
870
iGridVisibleAction = new QAction(tr("&Grid visible"), this);
871
iGridVisibleAction->setShortcut(Key("Zoom|Grid"));
872
iGridVisibleAction->setCheckable(true);
873
connect(iGridVisibleAction, SIGNAL(toggled(bool)),
874
SLOT(GridVisible(bool)));
876
iCoordinatesVisibleAction = new QAction(tr("&Coordinates visible"), this);
877
iCoordinatesVisibleAction->setShortcut(Key("Zoom|Coordinates"));
878
iCoordinatesVisibleAction->setCheckable(true);
879
connect(iCoordinatesVisibleAction, SIGNAL(toggled(bool)),
880
SLOT(CoordinatesVisible(bool)));
883
mouseIn[0] = new IpeAction(0, tr("points"), this);
884
mouseIn[1] = new IpeAction(1, tr("millimeters"), this);
885
mouseIn[2] = new IpeAction(2, tr("inches"), this);
886
QMenu *sub = new QMenu();
887
for (int i = 0; i < 3; ++i) {
888
connect(mouseIn[i], SIGNAL(triggered(int)), SLOT(SetMouseDisplayIn(int)));
889
sub->addAction(mouseIn[i]);
891
sub->setTitle(QLatin1String("Coordinates in"));
893
QAction *zoomInAct = new QAction(tr("Zoom &in"), this);
894
zoomInAct->setShortcut(Key("Zoom|Zoom in"));
895
connect(zoomInAct, SIGNAL(triggered()), iResolution, SLOT(stepUp()));
897
QAction *zoomOutAct = new QAction(tr("Zoom &out"), this);
898
zoomOutAct->setShortcut(Key("Zoom|Zoom out"));
899
connect(zoomOutAct, SIGNAL(triggered()), iResolution, SLOT(stepDown()));
901
QAction *fitPageAct = new QAction(tr("Fit &page"), this);
902
fitPageAct->setShortcut(Key("Zoom|Fit page"));
903
connect(fitPageAct, SIGNAL(triggered()), SLOT(FitPage()));
905
QAction *fitObjectsAct = new QAction(tr("&Fit objects"), this);
906
fitObjectsAct->setShortcut(Key("Zoom|Fit objects"));
907
connect(fitObjectsAct, SIGNAL(triggered()), SLOT(FitObjects()));
909
QAction *fitSelectionAct = new QAction(tr("Fit &selection"), this);
910
fitSelectionAct->setShortcut(Key("Zoom|Fit selection"));
911
connect(fitSelectionAct, SIGNAL(triggered()), SLOT(FitSelection()));
913
QAction *panHereAct = new IpeAction(ECmdHere, tr("Pan &here"), this);
914
panHereAct->setShortcut(Key("Snap|Pan here"));
915
connect(panHereAct, SIGNAL(triggered(int)), SLOT(SnapCmd(int)));
917
iZoomMenu->addAction(iGridVisibleAction);
918
iZoomMenu->addAction(iCoordinatesVisibleAction);
919
iZoomMenu->addMenu(sub);
920
iZoomMenu->addSeparator();
921
iZoomMenu->addAction(zoomInAct);
922
iZoomMenu->addAction(zoomOutAct);
923
iZoomMenu->addAction(normalSizeAct);
924
iZoomMenu->addAction(fitPageAct);
925
iZoomMenu->addAction(fitObjectsAct);
926
iZoomMenu->addAction(fitSelectionAct);
927
iZoomMenu->addSeparator();
928
iZoomMenu->addAction(panHereAct);
930
// --------------------------------------------------------------------
932
// --------------------------------------------------------------------
934
QAction *newLayerAct = new IpeAction(ECmdNewLayer, tr("&New layer"), this);
935
newLayerAct->setShortcut(Key("Layer|New"));
936
connect(newLayerAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
938
QAction *renameLayerAct =
939
new IpeAction(ECmdRenameLayer, tr("&Rename layer"), this);
940
renameLayerAct->setShortcut(Key("Layer|Rename"));
941
connect(renameLayerAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
943
QAction *selectLayerAct =
944
new IpeAction(ECmdSelectLayer, tr("&Select all in layer"), this);
945
selectLayerAct->setShortcut(Key("Layer|Select all"));
946
connect(selectLayerAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
948
QAction *moveToLayerAct =
949
new IpeAction(ECmdMoveToLayer, tr("&Move objects to layer"), this);
950
moveToLayerAct->setShortcut(Key("Layer|Move objects"));
951
connect(moveToLayerAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
953
iLayerMenu->addAction(newLayerAct);
954
iLayerMenu->addAction(renameLayerAct);
955
iLayerMenu->addSeparator();
956
iLayerMenu->addAction(selectLayerAct);
957
iLayerMenu->addAction(moveToLayerAct);
959
// --------------------------------------------------------------------
961
// --------------------------------------------------------------------
963
QAction *nextViewAct = new QAction(tr("Next vie&w"), this);
964
nextViewAct->setShortcut(Key("View|Next view"));
965
connect(nextViewAct, SIGNAL(triggered()), SLOT(NextView()));
967
QAction *previousViewAct = new QAction(tr("&Previous view"), this);
968
previousViewAct->setShortcut(Key("View|Previous view"));
969
connect(previousViewAct, SIGNAL(triggered()), SLOT(PreviousView()));
971
QAction *firstViewAct =
972
new IpeAction(ECmdFirstView, tr("&First view"), this);
973
firstViewAct->setShortcut(Key("View|First view"));
974
connect(firstViewAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
976
QAction *lastViewAct =
977
new IpeAction(ECmdLastView, tr("&Last view"), this);
978
lastViewAct->setShortcut(Key("View|Last view"));
979
connect(lastViewAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
981
QAction *newLayerNewViewAct =
982
new IpeAction(ECmdNewLayerNewView, tr("&New layer, new view"), this);
983
newLayerNewViewAct->setShortcut(Key("View|New layer, new view"));
984
connect(newLayerNewViewAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
986
QAction *newViewAct = new IpeAction(ECmdNewView, tr("New &view"), this);
987
newViewAct->setShortcut(Key("View|New view"));
988
connect(newViewAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
990
QAction *deleteViewAct =
991
new IpeAction(ECmdDeleteView, tr("&Delete view"), this);
992
deleteViewAct->setShortcut(Key("View|Delete view"));
993
connect(deleteViewAct, SIGNAL(triggered(int)), SLOT(Cmd(int)));
995
QAction *editEffectsAct = new QAction(tr("&Edit effects"), this);
996
editEffectsAct->setShortcut(Key("View|Edit effects"));
997
connect(editEffectsAct, SIGNAL(triggered()), SLOT(EditEffects()));
999
iViewMenu->addAction(nextViewAct);
1000
iViewMenu->addAction(previousViewAct);
1001
iViewMenu->addAction(firstViewAct);
1002
iViewMenu->addAction(lastViewAct);
1003
iViewMenu->addSeparator();
1004
iViewMenu->addAction(newLayerNewViewAct);
1005
iViewMenu->addAction(newViewAct);
1006
iViewMenu->addAction(deleteViewAct);
1007
iViewMenu->addSeparator();
1008
iViewMenu->addAction(editEffectsAct);
1010
// --------------------------------------------------------------------
1012
// --------------------------------------------------------------------
1014
QAction *nextPageAct = new QAction(tr("&Next page"), this);
1015
connect(nextPageAct, SIGNAL(triggered()), iPageNumber, SLOT(stepUp()));
1016
nextPageAct->setShortcut(Key("Page|Next page"));
1018
QAction *previousPageAct = new QAction(tr("&Previous page"), this);
1019
connect(previousPageAct, SIGNAL(triggered()), iPageNumber, SLOT(stepDown()));
1020
previousPageAct->setShortcut(Key("Page|Previous page"));
1022
QAction *firstPageAct = new QAction(tr("&First page"), this);
1023
connect(firstPageAct, SIGNAL(triggered()), SLOT(FirstPage()));
1024
firstPageAct->setShortcut(Key("Page|First page"));
1026
QAction *lastPageAct = new QAction(tr("&Last page"), this);
1027
connect(lastPageAct, SIGNAL(triggered()), SLOT(LastPage()));
1028
lastPageAct->setShortcut(Key("Page|Last page"));
1030
QAction *insertPageAct = new QAction(tr("&Insert page"), this);
1031
connect(insertPageAct, SIGNAL(triggered()), SLOT(CreatePage()));
1032
insertPageAct->setShortcut(Key("Page|Insert page"));
1034
QAction *cutPageAct = new QAction(tr("&Cut page"), this);
1035
connect(cutPageAct, SIGNAL(triggered()), SLOT(CutPage()));
1036
cutPageAct->setShortcut(Key("Page|Cut page"));
1038
QAction *copyPageAct = new QAction(tr("Cop&y page"), this);
1039
connect(copyPageAct, SIGNAL(triggered()), SLOT(CopyPage()));
1040
copyPageAct->setShortcut(Key("Page|Copy page"));
1042
QAction *pastePageAct = new QAction(tr("P&aste page"), this);
1043
connect(pastePageAct, SIGNAL(triggered()), SLOT(PastePage()));
1044
pastePageAct->setShortcut(Key("Page|Paste page"));
1046
QAction *deletePageAct = new QAction(tr("&Delete page"), this);
1047
connect(deletePageAct, SIGNAL(triggered()), SLOT(DeletePage()));
1048
deletePageAct->setShortcut(Key("Page|Delete page"));
1050
QAction *editBookmarkAct = new QAction(tr("Edit &bookmarks"), this);
1051
editBookmarkAct->setShortcut(Key("View|Edit bookmarks"));
1052
connect(editBookmarkAct, SIGNAL(triggered()), SLOT(EditBookmarks()));
1054
iPageMenu->addAction(nextPageAct);
1055
iPageMenu->addAction(previousPageAct);
1056
iPageMenu->addAction(firstPageAct);
1057
iPageMenu->addAction(lastPageAct);
1058
iPageMenu->addSeparator();
1059
iPageMenu->addAction(insertPageAct);
1060
iPageMenu->addAction(cutPageAct);
1061
iPageMenu->addAction(copyPageAct);
1062
iPageMenu->addAction(pastePageAct);
1063
iPageMenu->addAction(deletePageAct);
1064
iPageMenu->addSeparator();
1065
iPageMenu->addAction(editBookmarkAct);
1067
// --------------------------------------------------------------------
1069
// --------------------------------------------------------------------
1071
iPasteBitmapAction = 0;
974
1072
for (uint i = 0; i < iIpeletMaster.size(); ++i) {
975
1073
Ipelet *ipelet = iIpeletMaster[i];
1074
IpeString keys = "Ipelet|";
1075
keys += ipelet->Label();
976
1076
if (ipelet->NumFunctions() > 1) {
977
QPopupMenu *pop = new QPopupMenu;
1077
QMenu *pop = new QMenu(QString::fromUtf8(ipelet->Label()));
1078
bool isBitmap = (!qstrcmp(ipelet->Label(), "Insert image"));
978
1080
for (int j = 0; j < ipelet->NumFunctions(); ++j) {
979
int id = pop->insertItem(ipelet->SubLabel(j),
980
this, SLOT(RunIpelet(int)),
981
Key(ipelet->KeySequence(j), "Ipelet"));
982
pop->setItemParameter(id, i * 0x1000 + j);
1081
QAction *a = new IpeAction(i * 0x1000 + j,
1082
QString::fromUtf8(ipelet->SubLabel(j)),
1084
a->setShortcut(Key(keys + ipelet->SubLabel(j)));
1085
connect(a, SIGNAL(triggered(int)), SLOT(RunIpelet(int)));
1087
if (isBitmap && j == 2)
1088
iPasteBitmapAction = a;
984
if (!qstrcmp(ipelet->Label(), "Insert image")) {
985
1091
// personal treatment
986
iFileMenu->insertItem(ipelet->Label(), pop, -1, 6);
987
iFileMenu->insertSeparator(6);
988
iPasteBitmapId = i * 0x1000 + 2;
1092
iFileMenu->insertMenu(runLatexAct, pop);
1093
iFileMenu->insertSeparator(runLatexAct);
990
iIpeletMenu->insertItem(ipelet->Label(), pop);
1095
iIpeletMenu->addMenu(pop);
992
int id = iIpeletMenu->insertItem(ipelet->Label(),
993
this, SLOT(RunIpelet(int)),
994
Key(ipelet->KeySequence(0), "Ipelet"));
995
iIpeletMenu->setItemParameter(id, i * 0x1000 + 1);
1097
QAction *a = new IpeAction(i * 0x1000 + 1,
1098
QString::fromUtf8(ipelet->Label()), this);
1099
a->setShortcut(Key(keys));
1100
connect(a, SIGNAL(triggered(int)), SLOT(RunIpelet(int)));
1101
iIpeletMenu->addAction(a);
998
menu->insertItem(tr("&Ipelets"), iIpeletMenu);
1000
menu->insertSeparator();
1002
QPopupMenu* help = new QPopupMenu;
1003
help->insertItem(tr("Ipe &manual"), this, SLOT(Manual()));
1004
help->insertItem(tr("&What's this"), this, SLOT(whatsThis()));
1005
help->insertSeparator();
1006
help->insertItem(tr("Pre&ferences"), this, SLOT(EditPrefs()));
1007
help->insertSeparator();
1008
help->insertItem(tr("&About Ipe..."), this, SLOT(About()));
1009
menu->insertItem(tr("&Help"), help);
1011
// --------------------------------------------------------------------
1013
iCanvas = new IpeCanvas(this, statusBar(), this);
1104
QAction *a = new QAction(tr("About ipelets"), this);
1105
a->setShortcut(Key("Ipelet|About ipelets"));
1106
iIpeletMenu->addAction(a);
1107
connect(a, SIGNAL(triggered()), SLOT(AboutIpelets()));
1109
// --------------------------------------------------------------------
1111
// --------------------------------------------------------------------
1113
QAction *manualAct = new QAction(tr("Ipe &manual"), this);
1114
manualAct->setShortcut(Key("Help|Ipe manual"));
1115
connect(manualAct, SIGNAL(triggered()), SLOT(Manual()));
1117
QAction *preferencesAct = new QAction(tr("Pre&ferences"), this);
1118
preferencesAct->setShortcut(Key("Help|Preferences"));
1119
connect(preferencesAct, SIGNAL(triggered()), SLOT(EditPrefs()));
1121
QAction *aboutAct = new QAction(tr("&About Ipe..."), this);
1122
aboutAct->setShortcut(Key("Help|About Ipe"));
1123
connect(aboutAct, SIGNAL(triggered()), SLOT(About()));
1125
iHelpMenu->addAction(manualAct);
1126
iHelpMenu->addAction(whatsThisAct);
1127
iHelpMenu->addSeparator();
1128
iHelpMenu->addAction(preferencesAct);
1129
iHelpMenu->addSeparator();
1130
iHelpMenu->addAction(aboutAct);
1132
// --------------------------------------------------------------------
1134
iCanvas = new IpeCanvas(this, statusBar(), prefs->iDoubleBuffer,
1135
this, prefs->iBitmapSize);
1014
1136
setCentralWidget(iCanvas);
1016
QWhatsThis::add(iCanvas, tr(canvasText));
1137
iCanvas->setWhatsThis(tr(canvasText));
1018
1139
iResolution->setValue(72000);