Exemplo n.º 1
0
void ToolSettings::setPreviousTool()
{
	selectTool(d->previousTool);
	tools::BrushSettings *bs = qobject_cast<tools::BrushSettings*>(d->currentSettings());
	if(bs)
		bs->selectBrushSlot(d->previousToolSlot);
}
Exemplo n.º 2
0
void ToolSettings::selectToolSlot(int i)
{
	_quickslot[i]->setChecked(true);
	_currentQuickslot = i;

	setForegroundColor(_toolprops[i].foregroundColor());
	selectTool(tools::Tool::Type(_toolprops[i].currentTool()));
}
Exemplo n.º 3
0
/**
 * Set which tool setting widget is visible
 * @param tool tool identifier
 */
void ToolSettings::setTool(tools::Tool::Type tool) {
	if(tool != d->currentTool) {
		d->previousTool = d->currentTool;
		tools::BrushSettings *bs = qobject_cast<tools::BrushSettings*>(d->currentSettings());
		d->previousToolSlot = bs ? bs->currentBrushSlot() : 0;
		selectTool(tool);
	}
}
Exemplo n.º 4
0
void ToolSettings::readSettings()
{
	QSettings cfg;
	cfg.beginGroup("tools");
	cfg.beginGroup("toolset");
	for(auto ts : d->toolSettings) {
		cfg.beginGroup(ts->toolType());
		ts->restoreToolSettings(tools::ToolProperties::load(cfg));
		cfg.endGroup();
	}
	cfg.endGroup();
	setForegroundColor(cfg.value("color").value<QColor>());
	selectTool(tools::Tool::Type(cfg.value("tool").toInt()));
}
Exemplo n.º 5
0
void TupSymbolEditor::loadTools()
{
    QActionGroup *group = new QActionGroup(this);
    group->setExclusive(true);
    
    foreach (QObject *plugin, TupPluginManager::instance()->tools()) {
             TupToolPlugin *tool = qobject_cast<TupToolPlugin *>(plugin);
        
             QStringList::iterator it;
             QStringList keys = tool->keys();
            
             for (it = keys.begin(); it != keys.end(); ++it) {
                  #ifdef K_DEBUG
                         tDebug("plugins") << "*** Tool Loaded: " << *it;
                  #endif
            
                  TAction *act = tool->actions()[*it];
                  if (act) {
                      connect(act, SIGNAL(triggered()), this, SLOT(selectTool()));
                
                      switch (tool->toolType()) {
                              case TupToolInterface::Selection:
                              {
                                   k->selectionTools->addAction(act);
                              }
                              break;
                              case TupToolInterface::Fill:
                              {
                                   k->fillTools->addAction(act);
                              }
                              break;
                              case TupToolInterface::View:
                              {
                                   k->viewTools->addAction(act);
                              }
                              break;
                              case TupToolInterface::Brush:
                              {
                                   k->brushTools->addAction(act);
                              }
                              break;
                      }
                
                      group->addAction(act);
                      act->setCheckable(true);
                      act->setParent(plugin);
                  }
             }
    }
void ToolHandler::initTools()
{
	XOJ_CHECK_TYPE(ToolHandler);

	Tool* t = NULL;

	for (int i = 0; i < TOOL_COUNT; i++)
	{
		tools[i] = NULL;
	}

	double* thickness = new double[5];
	// pen thicknesses = 0.15, 0.3, 0.5, 0.8, 2 mm
	thickness[TOOL_SIZE_VERY_FINE] = 0.42;
	thickness[TOOL_SIZE_FINE] = 0.85;
	thickness[TOOL_SIZE_MEDIUM] = 1.41;
	thickness[TOOL_SIZE_THICK] = 2.26;
	thickness[TOOL_SIZE_VERY_THICK] = 5.67;
	t = new Tool("pen", TOOL_PEN, 0x3333CC, true, true, true, true, true, true, true, thickness);
	tools[TOOL_PEN - TOOL_PEN] = t;

	thickness = new double[5];
	thickness[TOOL_SIZE_VERY_FINE] = 2.83;
	thickness[TOOL_SIZE_FINE] = 2.83;
	thickness[TOOL_SIZE_MEDIUM] = 8.50;
	thickness[TOOL_SIZE_THICK] = 19.84;
	thickness[TOOL_SIZE_VERY_THICK] = 19.84;
	t = new Tool("eraser", TOOL_ERASER, 0x000000, false, true, false, false, false, false, false, thickness);
	tools[TOOL_ERASER - TOOL_PEN] = t;

	// highlighter thicknesses = 1, 3, 7 mm
	thickness = new double[5];
	thickness[TOOL_SIZE_VERY_FINE] = 2.83;
	thickness[TOOL_SIZE_FINE] = 2.83;
	thickness[TOOL_SIZE_MEDIUM] = 8.50;
	thickness[TOOL_SIZE_THICK] = 19.84;
	thickness[TOOL_SIZE_VERY_THICK] = 19.84;
	t = new Tool("hilighter", TOOL_HILIGHTER, 0xFFFF00, true, true, true, true, true, true, true, thickness);
	tools[TOOL_HILIGHTER - TOOL_PEN] = t;

	t = new Tool("text", TOOL_TEXT, 0x000000, true, false, false, false, false, false, false, NULL);
	tools[TOOL_TEXT - TOOL_PEN] = t;

	t = new Tool("image", TOOL_IMAGE, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_IMAGE - TOOL_PEN] = t;

	t = new Tool("selectRect", TOOL_SELECT_RECT, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_SELECT_RECT - TOOL_PEN] = t;

	t = new Tool("selectRegion", TOOL_SELECT_REGION, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_SELECT_REGION - TOOL_PEN] = t;

	t = new Tool("selectObject", TOOL_SELECT_OBJECT, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_SELECT_OBJECT - TOOL_PEN] = t;

	t = new Tool("verticalSpace", TOOL_VERTICAL_SPACE, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_VERTICAL_SPACE - TOOL_PEN] = t;

	t = new Tool("hand", TOOL_HAND, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_HAND - TOOL_PEN] = t;

	/*
	t = new Tool("drawRect", TOOL_DRAW_RECT, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_DRAW_RECT - TOOL_PEN] = t;

	t = new Tool("drawCircle", TOOL_DRAW_CIRCLE, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_DRAW_CIRCLE - TOOL_PEN] = t;

	t = new Tool("drawArrow", TOOL_DRAW_ARROW, 0x000000, false, false, false, false, false, false, false, NULL);
	tools[TOOL_DRAW_ARROW - TOOL_PEN] = t;
	 */


	selectTool(TOOL_PEN);
}
Exemplo n.º 7
0
void ToolSettings::setPreviousTool()
{
	saveCurrentTool();
	selectTool(_previousTool);
}
Exemplo n.º 8
0
/**
 * Set which tool setting widget is visible
 * @param tool tool identifier
 */
void ToolSettings::setTool(tools::Tool::Type tool) {
	// Save old tool settings, then switch to the new tool
	_previousTool = currentTool();
	saveCurrentTool();
	selectTool(tool);
}
Exemplo n.º 9
0
void ScreenshotEditWidget::on_arrowDrawButton_clicked() {
    selectTool(ST_Arrow);
}
Exemplo n.º 10
0
void ScreenshotEditWidget::on_rectangleDrawButton_clicked() {
    selectTool(ST_Rectangle);
}
Exemplo n.º 11
0
void ScreenshotEditWidget::on_customDrawButton_clicked() {
    selectTool(ST_CustomDraw);
}