[go: up one dir, main page]

Menu

[r381]: / mimagewidget.cpp  Maximize  Restore  History

Download this file

118 lines (95 with data), 3.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* Marcion
Copyright (C) 2009 - 2011 Milan Konvicka
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program */
#include "mimagewidget.h"
#include "ui_mimagewidget.h"
MImageWidget::MImageWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MImageWidget),
bgr()
{
ui->setupUi(this);
ui->ccPen->init("white",m_sett()->imgSelBorderColor().name(),tr("border color"),true);
ui->ccFill->init("white",m_sett()->imgSelFillColor().name(),tr("fill color"),true);
ui->spnBorder->setValue(m_sett()->imgSelBorderWidth());
ui->spnOpacity->setValue(m_sett()->imgSelFillOpacity());
bgr.addButton(ui->btMove,1);
bgr.addButton(ui->btSelect,2);
ui->gbSett->setVisible(false);
}
MImageWidget::~MImageWidget()
{
delete ui;
}
CMImage * MImageWidget::drawarea()
{
return ui->gwArea;
}
void MImageWidget::on_gwArea_positionChanged(QPointF pos)
{
ui->lblPosX->setText(QString::number((int)pos.x()));
ui->lblPosY->setText(QString::number((int)pos.y()));
}
void MImageWidget::on_btImageAction_clicked()
{
ui->gwArea->showPopupOnButton(ui->btImageAction->mapToGlobal(QPoint(0,0)));
}
void MImageWidget::on_btMove_clicked(bool checked)
{
if(checked)
ui->gwArea->setMouseMode(CMImage::Move,false);
}
void MImageWidget::on_btSelect_clicked(bool checked)
{
if(checked)
ui->gwArea->setMouseMode(CMImage::Select,false);
}
void MImageWidget::on_gwArea_mouseModeChanged(int mouse_mode)
{
switch(mouse_mode)
{
case CMImage::Move :
ui->btMove->setChecked(true);
break;
case CMImage::Select :
ui->btSelect->setChecked(true);
break;
}
}
void MImageWidget::on_btSett_clicked(bool checked)
{
ui->gbSett->setVisible(checked);
ui->gwArea->setSettingsState(checked);
}
void MImageWidget::on_gwArea_settingsActivated(bool visible)
{
ui->gbSett->setVisible(visible);
ui->btSett->setChecked(visible);
}
void MImageWidget::on_spnBorder_valueChanged(int value)
{
ui->gwArea->setSelectionBorderWidth(value);
}
void MImageWidget::on_spnOpacity_valueChanged(int value)
{
QColor color(ui->ccFill->bgC());
color.setAlpha(2.55*value);
ui->gwArea->setSelectionFillColor(color);
}
void MImageWidget::on_ccPen_bgColorSelected(QColor color)
{
ui->gwArea->setSelectionBorderColor(color);
}
void MImageWidget::on_ccFill_bgColorSelected(QColor color)
{
color.setAlpha(2.55*ui->spnOpacity->value());
ui->gwArea->setSelectionFillColor(color);
}