Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions artpaint/tools/ColorSelectorTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,25 @@ ColorSelectorTool::ColorSelectorTool()
fOptionsCount = 2;

SetOption(SIZE_OPTION, 1);
SetOption(MODE_OPTION, HS_ALL_BUTTONS);
SetOption(MODE_OPTION, 0);

fToolSettings.size = 1;
fToolSettings.mode = 0;
}


ToolScript*
ColorSelectorTool::UseTool(ImageView* view, uint32 buttons, BPoint point, BPoint view_point)
{
BWindow* window = view->Window();
BBitmap* bitmap = view->ReturnImage()->ReturnActiveBitmap();
BBitmap* bitmap;

if (window != NULL) {
if (fToolSettings.mode == 0)
bitmap = view->ReturnImage()->ReturnActiveBitmap();
else
bitmap = view->ReturnImage()->ReturnRenderedImage();

BitmapDrawer* drawer = new BitmapDrawer(bitmap);

BPoint original_point, original_view_point, prev_view_point;
Expand Down Expand Up @@ -461,9 +469,24 @@ ColorSelectorToolConfigView::ColorSelectorToolConfigView(DrawingTool* tool)

fSizeSlider = new NumberSliderControl(B_TRANSLATE("Size:"), "1", message, 1, 10, false);

BMessage* all_layers_message = new BMessage(OPTION_CHANGED);
all_layers_message->AddInt32("option", MODE_OPTION);
all_layers_message->AddInt32("value", tool->GetCurrentValue(MODE_OPTION));
fAllLayersCheckbox = new BCheckBox(B_TRANSLATE("Sample all layers"), all_layers_message);

BGridLayout* sizeLayout = LayoutSliderGrid(fSizeSlider);
layout->AddView(sizeLayout->View());

layout->AddView(BGroupLayoutBuilder(B_VERTICAL, kWidgetSpacing)
.Add(sizeLayout)
.Add(fAllLayersCheckbox)
.TopView()
);
}

if (tool->GetCurrentValue(MODE_OPTION) == 1)
fAllLayersCheckbox->SetValue(B_CONTROL_ON);
else
fAllLayersCheckbox->SetValue(B_CONTROL_OFF);
}


Expand All @@ -473,4 +496,5 @@ ColorSelectorToolConfigView::AttachedToWindow()
DrawingToolConfigView::AttachedToWindow();

fSizeSlider->SetTarget(this);
fAllLayersCheckbox->SetTarget(this);
}
4 changes: 4 additions & 0 deletions artpaint/tools/ColorSelectorTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include "DrawingTool.h"


#include "CheckBox.h"


class ImageView;


Expand Down Expand Up @@ -45,6 +48,7 @@ class ColorSelectorToolConfigView : public DrawingToolConfigView {

private:
NumberSliderControl* fSizeSlider;
BCheckBox* fAllLayersCheckbox;
};


Expand Down