-
Notifications
You must be signed in to change notification settings - Fork 1
/
gerberplotterdialog.h
121 lines (96 loc) · 3.95 KB
/
gerberplotterdialog.h
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
118
119
120
121
#ifndef GERBERPLOTTERDIALOG_H
#define GERBERPLOTTERDIALOG_H
#include <QDialog>
#include <QLineEdit>
#include <QPushButton>
#include <QDir>
#include <QDebug>
#include <QFileDialog>
#include <QString>
#include <QColor>
#include <QPalette>
#include <QSignalBlocker>
#include <QTemporaryFile>
#include "QtColorWidgets/color_dialog.hpp"
#include "color.h"
#include "gerbv.h"
enum pcb_color_t { PCB_GREEN, PCB_BLUE, PCB_RED, PCB_YELLOW, PCB_WHITE, PCB_BLACK, PCB_CUSTOM };
enum graphics_format_t { JPEG, PNG };
enum pcb_side_t { PCB_TOP, PCB_BOTTOM };
typedef enum pcb_color_t pcb_color;
typedef enum graphics_format_t graphics_format;
typedef enum pcb_side_t pcb_side;
namespace Ui {
class GerberPlotterDialog;
}
class GerberPlotterDialog : public QDialog {
Q_OBJECT
public:
explicit GerberPlotterDialog( QWidget *parent = nullptr );
~GerberPlotterDialog();
Q_ENUM( pcb_color );
Q_ENUM( graphics_format );
Q_ENUM( pcb_side );
const std::string greenPcbSilverPad = "046703;4b8748;fefffa;c4c4c4;50";
const std::string greenPcbGoldPad = "036702;5a8931;fefffa;ebc888;50";
const std::string bluePcbSilverPad = "0b01f5;4c4be4;f2ffff;c4c4c4;50";
const std::string bluePcbGoldPad = "0b01f5;5b4ccf;f2ffff;ebc888;50";
const std::string redPcbSilverPad = "fc0702;e84c48;fff6f6;c4c4c4;50";
const std::string redPcbGoldPad = "fc0702;f64d31;fff6f6;ebc888;50";
const std::string yellowPcbSilverPad = "e0e907;d6dc4b;fffdf9;c4c4c4;50";
const std::string yellowPcbGoldPad = "e0e907;e4dd35;fffdf9;ebc888;50";
const std::string whitePcbSilverPad = "ffffff;ececec;050505;c4c4c4;50";
const std::string whitePcbGoldPad = "ffffff;e9e6e1;050505;ebc888;50";
const std::string blackPcbSilverPad = "060602;4c4c47;ffffff;c4c4c4;50";
const std::string blackPcbGoldPad = "060602;5b4d31;ffffff;ebc888;50";
const std::string silverPcbPadColor = "c4c4c4";
const std::string goldPcbPadColor = "ebc888";
QString customPcbSilverPad = "000000;999999;ffffff;c4c4c4;50";
QString customPcbGoldPad = "000000;999999;ffffff;ebc888;50";
private:
Ui::GerberPlotterDialog *ui;
color_widgets::ColorDialog *colorDialog;
double imgSizeConstraint = 0.5;
QString disabledFieldStylesheet;
gerbv_project_t *mainProject;
gerbv_render_info_t screenRenderInfo;
QTemporaryFile *outlineImage;
QTemporaryFile *soldermaskImage;
QTemporaryFile *copperImage;
QTemporaryFile *drillsImage;
QTemporaryFile *silkscreenImage;
bool _outlineLoaded = false;
bool renderImage( std::string gerberFilename, std::string outlineGerberFilename, Color layerColor, std::string imageFilename, int width, int height );
protected:
QDir lastDir;
pcb_color pcbColorScheme;
graphics_format graphicsFormat = JPEG;
QColor _backgroundColor;
QColor _padsColor = Qt::white;
QString colorComboBoxText( QString text, QColor color );
QColor getLastCustomColor( QString text, bool alpha, QColor initialColor );
private Q_SLOTS:
void browseOpenFile( QLineEdit *lineEdit, QString promptText, QString browseDir, QString fileFilters );
void browseSaveFile( QLineEdit *lineEdit, QString promptText, QString browseDir, QString fileFilter );
void colorSchemeChanged( void );
void imageFormatChanged( void );
void backgroundColorChanged( int index );
void padsColorChanged( int index );
QColor pickColor( QColor initialColor, QString windowTitle, bool alpha );
QString getLastDir( void );
void checkImageFormat( void );
void bottomSideOutputToggled( bool on );
void topSideOutputToggled( bool on );
void imgSizeChanged( int width, int height );
void loadGerberBoardOutline( void );
void toggleSizeLoaded( void );
QColor getBackgroundColor( void );
QColor getBaseColor( void );
QColor getSoldermaskColor( void );
QColor getCopperColor( void );
QColor getSilkscreenColor( void );
QColor getPadsColor( void );
QColor getAlphaMaskColor( void );
void generateImageFile( pcb_side pcbSide, bool flip );
};
#endif // GERBERPLOTTERDIALOG_H