예제 #1
0
void ColorListWidget::newColor()
{
	int row = color_table->currentRow();
	if (row < 0)
		row = color_table->rowCount();
	map->addColor(new MapColor(), row);
	
	map->updateAllObjects();
	
	editCurrentColor();
}
예제 #2
0
void ColorListWidget::duplicateColor()
{
	int row = color_table->currentRow();
	Q_ASSERT(row >= 0);
	if (row < 0) return; // In release mode
	
	auto new_color = new MapColor(*map->getColor(row));
	//: Future replacement for COLOR_NAME + " (Duplicate)", for better localization.
	void(tr("%1 (duplicate)")); /// \todo Switch translation
	new_color->setName(map->translate(new_color->getName()) + tr(" (Duplicate)"));
	map->addColor(new_color, row);
	
	map->updateAllObjects();
	
	editCurrentColor();
}
예제 #3
0
/*
 * ColorsWndProc - handle messages for the available color selection window
 */
WPI_MRESULT CALLBACK ColorsWndProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    static WPI_POINT            pt;

    switch( msg ) {
    case WM_CREATE:
        numberOfColors = 16;
        initPaletteBoxes( TRUE );
        InitPaletteBitmaps( hwnd, &hColorBitmap, &hMonoBitmap );
        break;

    case WM_PAINT:
        paintColors( hwnd );
        break;

    case WM_LBUTTONDOWN:
        IMGED_MAKEPOINT( wparam, lparam, pt );
        selectColor( &pt, LMOUSEBUTTON );
        break;

    case WM_LBUTTONDBLCLK:
        IMGED_MAKEPOINT( wparam, lparam, pt );
        editCurrentColor( &pt );
        break;

    case WM_RBUTTONDOWN:
        IMGED_MAKEPOINT( wparam, lparam, pt );
        selectColor( &pt, RMOUSEBUTTON );
        break;

    case WM_DESTROY:
        _wpi_deletebitmap( hColorBitmap );
        _wpi_deletebitmap( hMonoBitmap );
        break;

    default:
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
    }
    return( 0 );

} /* ColorsWndProc */