void
wxLCDWindow::DrawTwoDots(wxDC* dc, int digit)
{
    int sl = m_segLen;
    int sw = m_segWidth;

    int x = DigitX(digit);
    int y = DigitY(digit);

    wxBrush brushOn(m_lightColr, wxSOLID);

    x += (sl / 2) - sw;
    y += (sl / 2) - sw;

    dc->SetBrush(brushOn);
    dc->SetPen(wxPen(GetBackgroundColour(), 1, wxSOLID));

    dc->DrawEllipse(x, y, 2 * sw, 2 * sw);

    y += sl;

    dc->DrawEllipse(x, y, 2 * sw, 2 * sw);
}
Example #2
0
void kwxLCDDisplay::DrawTwoDots( wxDC *dc, int digit )
{
	int sl = mSegmentLen;
	int sw = mSegmentWidth;
//	int sp = mSpace;

	int x = DigitX( digit );
	int y = DigitY( digit );

	wxBrush brushOn( mLightColour, wxSOLID );

	x += ( sl / 2 ) - sw;
	y += ( sl / 2 ) - sw;

	dc->SetBrush( brushOn );
	dc->SetPen( wxPen( GetBackgroundColour(), 1, wxSOLID ) );

	dc->DrawEllipse( x, y, 2 * sw, 2 * sw );

	y += sl;

	dc->DrawEllipse( x, y, 2 * sw, 2 * sw );
}
void
wxLCDWindow::DrawSegment(wxDC* dc, int digit, int seg, bool state)
{
    int sl = m_segLen;
    int sw = m_segWidth;

    int x = DigitX(digit);
    int y = DigitY(digit);

    wxBrush brushOn(m_lightColr, wxSOLID);
    wxBrush brushOff(m_grayColr, wxSOLID);

    if (state) {
        dc->SetBrush(brushOn);
    }
    else {
        dc->SetBrush(brushOff);
    }

    dc->SetPen(wxPen(GetBackgroundColour(), 1, wxSOLID));

    wxPoint points[4];

    switch(seg) {
    case 0:
        points[0].x = x;
        points[0].y = y;
        points[1].x = x + sl;
        points[1].y = y;
        points[2].x = x + sl - sw;
        points[2].y = y + sw;
        points[3].x = x + sw;
        points[3].y = y + sw;
        break;
    case 5:
        y += 2 * sl - sw;
        points[0].x = x + sw;
        points[0].y = y;
        points[1].x = x + sl - sw;
        points[1].y = y;
        points[2].x = x + sl;
        points[2].y = y + sw;
        points[3].x = x;
        points[3].y = y + sw;
        break;
    case 4:
        y += sl;
        x += sl - sw;
        points[0].x = x;
        points[0].y = y + sw / 2;
        points[1].x = x + sw;
        points[1].y = y;
        points[2].x = x + sw;
        points[2].y = y + sl;
        points[3].x = x;
        points[3].y = y + sl - sw;
        break;    
    case 2:
        x += sl - sw;
        points[0].x = x;
        points[0].y = y + sw;
        points[1].x = x + sw;
        points[1].y = y;
        points[2].x = x + sw;
        points[2].y = y + sl;
        points[3].x = x;
        points[3].y = y + sl - sw / 2;
        break;
    case 3:
        y += sl;
        points[0].x = x;
        points[0].y = y;
        points[1].x = x;
        points[1].y = y + sl;
        points[2].x = x + sw;
        points[2].y = y + sl - sw;
        points[3].x = x + sw;
        points[3].y = y + sw - sw / 2;
        break;
    case 1:
        points[0].x = x;
        points[0].y = y;
        points[1].x = x;
        points[1].y = y + sl;
        points[2].x = x + sw;
        points[2].y = y + sl - sw / 2;
        points[3].x = x + sw;
        points[3].y = y + sw;
        break;
    case 6:
    default:
        break;
    }

    if (seg < 6) {
        dc->DrawPolygon(4, points);
    }
    
    if (seg == 6) {
        y += sl - sw / 2;
        wxPoint p6[6];

        p6[0].x = x;
        p6[0].y = y + sw / 2;
        p6[1].x = x + sw;
        p6[1].y = y;
        p6[2].x = x + sl - sw;
        p6[2].y = y;
        p6[3].x = x + sl;
        p6[3].y = y + sw / 2;
        p6[4].x = x + sl - sw;
        p6[4].y = y + sw;
        p6[5].x = x + sw;
        p6[5].y = y + sw;

        dc->DrawPolygon(6, p6);
    }

    if (seg == 7) {
        y += 2 * sl;
        x += sl;

        dc->DrawEllipse(x + 1, y - sw, sw, sw);
    }
}
Example #4
0
void MainWindow2::createMenus()
{
    // ---------- File Menu -------------
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newDocument()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openDocument()));
    connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAsNewDocument()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveDocument()));
    connect(ui->actionPrint, SIGNAL(triggered()), editor, SLOT(print()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    /// --- Export Menu ---
    connect(ui->actionExport_X_sheet , SIGNAL(triggered()), editor, SLOT(exportX()));
    connect(ui->actionExport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(exportSeq()));
    connect(ui->actionExport_Image, SIGNAL(triggered()), editor, SLOT(exportImage()));
    connect(ui->actionExport_Movie, SIGNAL(triggered()), editor, SLOT(exportMov()));

    //exportFlashAct = new QAction(tr("&Flash/SWF..."), this);
    //exportFlashAct->setShortcut(tr("Ctrl+Alt+F"));
    //connect(exportFlashAct, SIGNAL(triggered()), editor, SLOT(exportFlash()));

    connect(ui->actionExport_Palette, SIGNAL(triggered()), this, SLOT(exportPalette()));

    /// --- Import Menu ---
    connect(ui->actionExport_Svg_Image, SIGNAL(triggered()), editor, SLOT(saveSvg()));
    connect(ui->actionImport_Image, SIGNAL(triggered()), editor, SLOT(importImage()));
    connect(ui->actionImport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(importImageSequence()));
    connect(ui->actionImport_Movie, SIGNAL(triggered()), editor, SLOT(importMov()));
    connect(ui->actionImport_Sound, SIGNAL(triggered()), editor, SLOT(importSound()));
    connect(ui->actionImport_Palette, SIGNAL(triggered()), this, SLOT(importPalette()));

    /// --- Edit Menu ---
    connect(ui->actionUndo, SIGNAL(triggered()), editor, SLOT(undo()));
    connect(ui->actionRedo, SIGNAL(triggered()), editor, SLOT(redo()));
    connect(ui->actionCut, SIGNAL(triggered()), editor, SLOT(cut()));
    connect(ui->actionCopy, SIGNAL(triggered()), editor, SLOT(copy()));
    connect(ui->actionPaste, SIGNAL(triggered()), editor, SLOT(paste()));
    connect(ui->actionDelete, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame()));
    connect(ui->actionCrop, SIGNAL(triggered()), editor, SLOT(crop()));
    connect(ui->actionCrop_To_Selection, SIGNAL(triggered()), editor, SLOT(croptoselect()));
    connect(ui->actionSelect_All, SIGNAL(triggered()), editor, SIGNAL(selectAll()));
    connect(ui->actionDeselect_All, SIGNAL(triggered()), editor, SLOT(deselectAll()));
    connect(ui->actionPreference, SIGNAL(triggered()), this, SLOT(showPreferences()));

    ui->actionRedo->setEnabled(false);

    /// --- Layer Menu ---
    connect(ui->actionNew_Bitmap_Layer, SIGNAL(triggered()), editor, SLOT(newBitmapLayer()));
    connect(ui->actionNew_Vector_Layer, SIGNAL(triggered()), editor, SLOT(newVectorLayer()));
    connect(ui->actionNew_Sound_Layer, SIGNAL(triggered()), editor, SLOT(newSoundLayer()));
    connect(ui->actionNew_Camera_Layer, SIGNAL(triggered()), editor, SLOT(newCameraLayer()));
    connect(ui->actionDelete_Current_Layer, SIGNAL(triggered()), editor, SLOT(deleteCurrentLayer()));

    /// --- View Menu ---
    connect(ui->actionZoom_In, SIGNAL(triggered()), editor, SLOT(setzoom()));
    connect(ui->actionZoom_Out, SIGNAL(triggered()), editor, SLOT(setzoom1()));
    connect(ui->actionRotate_Clockwise, SIGNAL(triggered()), editor, SLOT(rotatecw()));
    connect(ui->actionRotate_Anticlosewise, SIGNAL(triggered()), editor, SLOT(rotateacw()));
    connect(ui->actionReset_Windows, SIGNAL(triggered()), this, SLOT(dockAllPalettes()));
    connect(ui->actionReset_View, SIGNAL(triggered()), editor, SLOT(resetView()));
    connect(ui->actionHorizontal_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirror()));
    connect(ui->actionVertical_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirrorV()));

    ui->actionPreview->setEnabled(false);
    //#	connect(previewAct, SIGNAL(triggered()), editor, SLOT(getCameraLayer()));//TODO: Preview view

    ui->actionGrid->setEnabled(false);
    connect(ui->actionGrid, SIGNAL(triggered()), editor, SLOT(gridview())); //TODO: Grid view

    connect(ui->actionOnionPrevious, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionPrev(bool)));
    connect(editor, SIGNAL(onionPrevChanged(bool)), ui->actionOnionPrevious, SLOT(setChecked(bool)));

    connect(ui->actionOnionNext, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionNext(bool)));
    connect(editor, SIGNAL(onionNextChanged(bool)), ui->actionOnionNext, SLOT(setChecked(bool)));

    /// --- Animation Menu ---
    connect(ui->actionPlay, SIGNAL(triggered()), editor, SLOT(play()));
    connect(ui->actionLoop, SIGNAL(triggered(bool)), editor, SLOT(setLoop(bool)));
    connect(ui->actionLoop, SIGNAL(toggled(bool)), editor, SIGNAL(toggleLoop(bool))); //TODO: WTF?
    connect(editor, SIGNAL(loopToggled(bool)), ui->actionLoop, SLOT(setChecked(bool)));

    connect(ui->actionAdd_Frame, SIGNAL(triggered()), editor, SLOT(addKey()));
    connect(ui->actionRemove_Frame, SIGNAL(triggered()), editor, SLOT(removeKey()));
    connect(ui->actionNext_Frame, SIGNAL(triggered()), editor, SLOT(playNextFrame()));
    connect(ui->actionPrevious_Frame, SIGNAL(triggered()), editor, SLOT(playPrevFrame()));
    connect(ui->actionNext_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubNextKeyframe()));
    connect(ui->actionPrev_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubPreviousKeyframe()));
    connect(ui->actionDuplicate_Frame, SIGNAL(triggered()), editor, SLOT(duplicateKey()));

    /// --- Tool Menu ---
    connect(ui->actionClear, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame()));

    connect(ui->actionMove, SIGNAL(triggered()), m_toolSet, SLOT(moveOn()));
    connect(ui->actionSelect, SIGNAL(triggered()), m_toolSet, SLOT(selectOn()));
    connect(ui->actionBrush, SIGNAL(triggered()), m_toolSet, SLOT(brushOn()));
    connect(ui->actionPolyline, SIGNAL(triggered()), m_toolSet, SLOT(polylineOn()));
    connect(ui->actionSmudge, SIGNAL(triggered()), m_toolSet, SLOT(smudgeOn()));
    connect(ui->actionPen, SIGNAL(triggered()), m_toolSet, SLOT(penOn()));
    connect(ui->actionHand, SIGNAL(triggered()), m_toolSet, SLOT(handOn()));
    connect(ui->actionPencil, SIGNAL(triggered()), m_toolSet, SLOT(pencilOn()));
    connect(ui->actionBucket, SIGNAL(triggered()), m_toolSet, SLOT(bucketOn()));
    connect(ui->actionEyedropper, SIGNAL(triggered()), m_toolSet, SLOT(eyedropperOn()));
    connect(ui->actionEraser, SIGNAL(triggered()), m_toolSet, SLOT(eraserOn()));

    connect(ui->actionResetToolsDefault, SIGNAL(triggered()), this, SLOT(resetToolsSettings()));

    /// --- Help Menu ---
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(helpBox()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPencil()));

    // --------------- Menus ------------------
    openRecentMenu = new QMenu(tr("Open recent"), this);

    connect(ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(undoActSetText()));
    connect(ui->menuEdit, SIGNAL(aboutToHide()), this, SLOT(undoActSetEnabled()));


}
Example #5
0
void kwxLCDDisplay::DrawSegment( wxDC *dc, int digit, int segment, bool state )
{
	int sl = mSegmentLen;
	int sw = mSegmentWidth;
//	int sp = mSpace;

	int x = DigitX( digit );
	int y = DigitY( digit );

	wxBrush brushOn( mLightColour, wxSOLID );
	wxBrush brushOff( mGrayColour, wxSOLID );

	if( state )
		dc->SetBrush( brushOn );
	else
		dc->SetBrush( brushOff );

	dc->SetPen( wxPen( GetBackgroundColour(), 1, wxSOLID ) );

	wxPoint points[4];
	wxPoint p6[6];

	switch( segment )
	{
		case 0:
			{
				points[0].x = x;
				points[0].y = y;
				points[1].x = x + sl;
				points[1].y = y;
				points[2].x = x + sl - sw;
				points[2].y = y + sw;
				points[3].x = x + sw;
				points[3].y = y + sw;
				break;
			}
		case 1:
			{
				points[0].x = x;
				points[0].y = y;
				points[1].x = x;
				points[1].y = y + sl;
				points[2].x = x + sw;
				points[2].y = y + sl - sw / 2;
				points[3].x = x + sw;
				points[3].y = y + sw;
				break;
			}
		case 2:
			{
				x += sl - sw;
				points[0].x = x;
				points[0].y = y + sw;
				points[1].x = x + sw;
				points[1].y = y;
				points[2].x = x + sw;
				points[2].y = y + sl;
				points[3].x = x;
				points[3].y = y + sl - sw / 2;
				break;
			}
		case 3:
			{
				y += sl;
				points[0].x = x;
				points[0].y = y;
				points[1].x = x;
				points[1].y = y + sl;
				points[2].x = x + sw;
				points[2].y = y + sl - sw;
				points[3].x = x + sw;
				points[3].y = y + sw - sw / 2;
				break;
			}
		case 4:
			{
				y += sl;
				x += sl - sw;
				points[0].x = x;
				points[0].y = y + sw / 2;
				points[1].x = x + sw;
				points[1].y = y;
				points[2].x = x + sw;
				points[2].y = y + sl;
				points[3].x = x;
				points[3].y = y + sl - sw;
				break;
			}
		case 5:
			{
				y += 2 * sl - sw;
				points[0].x = x + sw;
				points[0].y = y;
				points[1].x = x + sl - sw;
				points[1].y = y;
				points[2].x = x + sl;
				points[2].y = y + sw;
				points[3].x = x;
				points[3].y = y + sw;
				break;
			}
		case 6:
			{
				y += sl - sw / 2;

				p6[0].x = x;
				p6[0].y = y + sw / 2;
				p6[1].x = x + sw;
				p6[1].y = y;
				p6[2].x = x + sl - sw;
				p6[2].y = y;
				p6[3].x = x + sl;
				p6[3].y = y + sw / 2;
				p6[4].x = x + sl - sw;
				p6[4].y = y + sw;
				p6[5].x = x + sw;
				p6[5].y = y + sw;

				break ;
			}
		default:
			break;
	}

	if( segment < 6 )				//segmento normale
		dc->DrawPolygon( 4, points );
	else if ( segment == 6 )		//segmento centrale a 6 lati
		dc->DrawPolygon( 6, p6 );
	else							//comma
	{
		y += 2 * sl;
		x += sl;

		dc->DrawEllipse( x + 1, y - sw, sw, sw );
	}

}