-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from parallaxinc/preferences
New Preferences dialog, faster editing, now with indent guides
- Loading branch information
Showing
38 changed files
with
2,325 additions
and
977 deletions.
There are no files selected for viewing
Submodule memorymap
updated
6 files
+3 −4 | app/main.cpp | |
+1 −1 | src/QHexEdit | |
+1 −1 | src/memorymap/memorybar.h | |
+47 −5 | src/memorymap/memorymap.cpp | |
+8 −0 | src/memorymap/memorymap.h | |
+2 −15 | src/memorymap/memorymap.ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,47 @@ | ||
#include "colorchooser.h" | ||
|
||
#include <QColor> | ||
#include <QPixmap> | ||
#include <QPainter> | ||
#include <QMouseEvent> | ||
#include <QColorDialog> | ||
|
||
/* | ||
* This source file is part of EasyPaint. | ||
* | ||
* Copyright (c) 2012 LSPaint <https://github.com/Gr1N/LSPaint> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
#include "colorscheme.h" | ||
|
||
ColorChooser::ColorChooser(ColorScheme::Color newkey, QString hex, QWidget *parent) : | ||
ColorChooser::ColorChooser(QWidget *parent) : | ||
QLabel(parent) | ||
{ | ||
//setFrameStyle(QFrame::Raised | QFrame::Box); | ||
mCurrentColor = new QColor(hex); | ||
mPixmapColor = new QPixmap(80, 20); | ||
mPainterColor = new QPainter(mPixmapColor); | ||
mPainterColor->fillRect(0, 0, 80, 20, *mCurrentColor); | ||
mPainterColor->end(); | ||
setMargin(3); | ||
setAlignment(Qt::AlignHCenter); | ||
setPixmap(*mPixmapColor); | ||
key = newkey; | ||
} | ||
|
||
ColorChooser::~ColorChooser() | ||
{ | ||
delete mCurrentColor; | ||
delete mPainterColor; | ||
delete mPixmapColor; | ||
} | ||
|
||
void ColorChooser::setColor(const QColor &color) | ||
void ColorChooser::setKey(int key) | ||
{ | ||
*mCurrentColor = color; | ||
mPainterColor->begin(mPixmapColor); | ||
mPainterColor->fillRect(0, 0, 80, 20, *mCurrentColor); | ||
mPainterColor->end(); | ||
setPixmap(*mPixmapColor); | ||
_key = key; | ||
} | ||
|
||
void ColorChooser::setColor(QColor color) | ||
{ | ||
_color = color; | ||
QPalette p = this->palette(); | ||
p.setColor(QPalette::Window, color); | ||
this->setPalette(p); | ||
} | ||
|
||
void ColorChooser::mousePressEvent(QMouseEvent *event) | ||
{ | ||
if(event->button() == Qt::LeftButton) | ||
{ | ||
QColor color = QColorDialog::getColor(*mCurrentColor, this); | ||
QColor color = QColorDialog::getColor(_color, this); | ||
if(color.isValid()) | ||
{ | ||
setColor(color); | ||
emit sendColor(key, color); | ||
emit sendColor(_key, _color); | ||
} | ||
} | ||
} | ||
|
||
void ColorChooser::updateColor() | ||
{ | ||
setColor(Singleton<ColorScheme>::Instance().getColor(key)); | ||
setColor(Singleton<ColorScheme>::Instance().getColor((ColorScheme::Color) _key)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.