Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/kis_painting_assistants_decoration.cpp
Show All 36 Lines | |||||
37 | 37 | | |||
38 | struct KisPaintingAssistantsDecoration::Private { | 38 | struct KisPaintingAssistantsDecoration::Private { | ||
39 | Private() | 39 | Private() | ||
40 | : assistantVisible(false) | 40 | : assistantVisible(false) | ||
41 | , outlineVisible(false) | 41 | , outlineVisible(false) | ||
42 | , snapOnlyOneAssistant(true) | 42 | , snapOnlyOneAssistant(true) | ||
43 | , firstAssistant(0) | 43 | , firstAssistant(0) | ||
44 | , aFirstStroke(false) | 44 | , aFirstStroke(false) | ||
45 | , m_globalAssistantsColor(QColor(176, 176, 176, 255)), | ||||
dkazakov: Why default value for globalAssistantsColor is different in KisDocument and… | |||||
I just removed this duplicate definition. It doesn't appear to be getting used anyway scottpetrovic: I just removed this duplicate definition. It doesn't appear to be getting used anyway | |||||
46 | m_handleSize(14) | ||||
45 | {} | 47 | {} | ||
46 | 48 | | |||
47 | bool assistantVisible; | 49 | bool assistantVisible; | ||
48 | bool outlineVisible; | 50 | bool outlineVisible; | ||
49 | bool snapOnlyOneAssistant; | 51 | bool snapOnlyOneAssistant; | ||
50 | KisPaintingAssistantSP firstAssistant; | 52 | KisPaintingAssistantSP firstAssistant; | ||
51 | KisPaintingAssistantSP selectedAssistant; | 53 | KisPaintingAssistantSP selectedAssistant; | ||
52 | bool aFirstStroke; | 54 | bool aFirstStroke; | ||
53 | QColor m_globalAssistantsColor = QColor(176, 176, 176, 255); // kis_assistant_tool has same default color specified | 55 | QColor m_globalAssistantsColor; | ||
54 | bool m_isEditingAssistants = false; | 56 | bool m_isEditingAssistants = false; | ||
55 | bool m_outlineVisible = false; | 57 | bool m_outlineVisible = false; | ||
56 | int m_handleSize = 14; // size of editor handles on assistants | 58 | int m_handleSize; // size of editor handles on assistants | ||
57 | 59 | | |||
58 | // move, visibility, delete icons for each assistant. These only display while the assistant tool is active | 60 | // move, visibility, delete icons for each assistant. These only display while the assistant tool is active | ||
59 | // these icons will be covered by the kis_paintint_assistant_decoration with things like the perspective assistant | 61 | // these icons will be covered by the kis_paintint_assistant_decoration with things like the perspective assistant | ||
60 | 62 | | |||
61 | AssistantEditorData toolData; | 63 | AssistantEditorData toolData; | ||
62 | 64 | | |||
63 | QPixmap m_iconDelete = KisIconUtils::loadIcon("dialog-cancel").pixmap(toolData.deleteIconSize, toolData.deleteIconSize); | 65 | QPixmap m_iconDelete = KisIconUtils::loadIcon("dialog-cancel").pixmap(toolData.deleteIconSize, toolData.deleteIconSize); | ||
64 | QPixmap m_iconSnapOn = KisIconUtils::loadIcon("visible").pixmap(toolData.snapIconSize, toolData.snapIconSize); | 66 | QPixmap m_iconSnapOn = KisIconUtils::loadIcon("visible").pixmap(toolData.snapIconSize, toolData.snapIconSize); | ||
▲ Show 20 Lines • Show All 289 Lines • ▼ Show 20 Line(s) | |||||
354 | 356 | | |||
355 | QColor KisPaintingAssistantsDecoration::globalAssistantsColor() { | 357 | QColor KisPaintingAssistantsDecoration::globalAssistantsColor() { | ||
356 | return d->m_globalAssistantsColor; | 358 | return d->m_globalAssistantsColor; | ||
357 | } | 359 | } | ||
358 | 360 | | |||
359 | void KisPaintingAssistantsDecoration::setGlobalAssistantsColor(QColor color) | 361 | void KisPaintingAssistantsDecoration::setGlobalAssistantsColor(QColor color) | ||
360 | { | 362 | { | ||
361 | d->m_globalAssistantsColor = color; | 363 | d->m_globalAssistantsColor = color; | ||
364 | | ||||
365 | | ||||
366 | // view()->document() is referenced multiple times in this class | ||||
367 | // it is used to later store things in the KRA file when saving. | ||||
368 | view()->document()->setAssistantsGlobalColor(color); | ||||
362 | uncache(); | 369 | uncache(); | ||
363 | } | 370 | } | ||
364 | 371 | | |||
365 | void KisPaintingAssistantsDecoration::activateAssistantsEditor() | 372 | void KisPaintingAssistantsDecoration::activateAssistantsEditor() | ||
366 | { | 373 | { | ||
367 | setVisible(true); // this turns on the decorations in general. we leave it on at this point | 374 | setVisible(true); // this turns on the decorations in general. we leave it on at this point | ||
368 | d->m_isEditingAssistants = true; | 375 | d->m_isEditingAssistants = true; | ||
369 | uncache(); // updates visuals when editing | 376 | uncache(); // updates visuals when editing | ||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Line(s) | 426 | { | |||
469 | else { | 476 | else { | ||
470 | gc.drawPixmap(iconSnapPosition, d->m_iconSnapOff); | 477 | gc.drawPixmap(iconSnapPosition, d->m_iconSnapOff); | ||
471 | } | 478 | } | ||
472 | 479 | | |||
473 | gc.drawPixmap(iconDeletePosition, d->m_iconDelete); | 480 | gc.drawPixmap(iconDeletePosition, d->m_iconDelete); | ||
474 | 481 | | |||
475 | 482 | | |||
476 | } | 483 | } | ||
477 | | ||||
478 | QString KisPaintingAssistantsDecoration::qColorToQString(QColor color) | | |||
479 | { | | |||
480 | // color channels will usually have 0-255 | | |||
481 | QString customColor = QString::number(color.red()).append(",") | | |||
482 | .append(QString::number(color.blue())).append(",") | | |||
483 | .append(QString::number(color.green())).append(",") | | |||
484 | .append(QString::number(color.alpha())); | | |||
485 | | ||||
486 | return customColor; | | |||
487 | } | | |||
488 | | ||||
489 | QColor KisPaintingAssistantsDecoration::qStringToQColor(QString colorString) | | |||
490 | { | | |||
491 | QStringList colorComponents = colorString.split(','); | | |||
492 | return QColor(colorComponents[0].toInt(), colorComponents[1].toInt(), colorComponents[2].toInt(), colorComponents[3].toInt()); | | |||
493 | } | | |||
494 | |
Why default value for globalAssistantsColor is different in KisDocument and KisPaintingAssistantsDecoration? Perhaps, you could read it from KisConfig?