The color palette redefinition now has its own class
This commit is contained in:
parent
421314e89a
commit
ac8ac70b9c
|
@ -1,6 +1,7 @@
|
|||
2017-01-24 Markus Gans <guru.mail@muenster.de>
|
||||
* Fixes compiler errors for latest Cygwin versions
|
||||
* Widget color scheme settings moved to a separate class
|
||||
* The color palette redefinition now has its own class
|
||||
|
||||
2017-01-21 Markus Gans <guru.mail@muenster.de>
|
||||
* The Final Cut can now also be compiled under Cygwin
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/***********************************************************************
|
||||
* fcolorpalette.h - Define RGB color value for a palette entry *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* as published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* The Final Cut 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 Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this program. If not, see *
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
/* Standalone class
|
||||
* ════════════════
|
||||
*
|
||||
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||
* ▕ FColorPalette ▏
|
||||
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||
*/
|
||||
|
||||
#ifndef FCOLORPALETTE_H
|
||||
#define FCOLORPALETTE_H
|
||||
|
||||
#include "final/fc.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
class FColorPalette
|
||||
{
|
||||
public:
|
||||
// Typedefs
|
||||
typedef void (*funcp)(short, int, int, int);
|
||||
|
||||
// Methods
|
||||
static void set8ColorPalette (funcp);
|
||||
static void set16ColorPalette (funcp);
|
||||
static void reset8ColorPalette (funcp);
|
||||
static void reset16ColorPalette (funcp);
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#endif // FCOLORPALETTE_H
|
|
@ -119,6 +119,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "final/fc.h"
|
||||
#include "final/fcolorpalette.h"
|
||||
#include "final/fmouse.h"
|
||||
#include "final/fobject.h"
|
||||
#include "final/foptiattr.h"
|
||||
|
|
|
@ -45,6 +45,7 @@ libfinal_la_SOURCES = \
|
|||
foptimove.cpp \
|
||||
ftermbuffer.cpp \
|
||||
fapplication.cpp \
|
||||
fcolorpalette.cpp \
|
||||
fwidgetcolors.cpp \
|
||||
fwidget.cpp \
|
||||
fobject.cpp
|
||||
|
@ -100,6 +101,7 @@ finalcutinclude_HEADERS = \
|
|||
../include/final/fvterm.h \
|
||||
../include/final/ftextview.h \
|
||||
../include/final/ftogglebutton.h \
|
||||
../include/final/fcolorpalette.h \
|
||||
../include/final/fwidgetcolors.h \
|
||||
../include/final/fwidget.h \
|
||||
../include/final/fwindow.h
|
||||
|
|
|
@ -47,6 +47,7 @@ INCLUDE_HEADERS = \
|
|||
fvterm.h \
|
||||
ftextview.h \
|
||||
ftogglebutton.h \
|
||||
fcolorpalette.h \
|
||||
fwidgetcolors.h \
|
||||
fwidget.h \
|
||||
fwindow.h
|
||||
|
@ -100,6 +101,7 @@ OBJS = \
|
|||
foptimove.o \
|
||||
ftermbuffer.o \
|
||||
fapplication.o \
|
||||
fcolorpalette.o \
|
||||
fwidgetcolors.o \
|
||||
fwidget.o \
|
||||
fobject.o
|
||||
|
|
|
@ -47,6 +47,7 @@ INCLUDE_HEADERS = \
|
|||
fvterm.h \
|
||||
ftextview.h \
|
||||
ftogglebutton.h \
|
||||
fcolorpalette.h \
|
||||
fwidgetcolors.h \
|
||||
fwidget.h \
|
||||
fwindow.h
|
||||
|
@ -100,6 +101,7 @@ OBJS = \
|
|||
foptimove.o \
|
||||
ftermbuffer.o \
|
||||
fapplication.o \
|
||||
fcolorpalette.o \
|
||||
fwidgetcolors.o \
|
||||
fwidget.o \
|
||||
fobject.o
|
||||
|
|
|
@ -137,7 +137,7 @@ am_libfinal_la_OBJECTS = fstring.lo fpoint.lo frect.lo fscrollbar.lo \
|
|||
fwindow.lo fmessagebox.lo ftooltip.lo ffiledialog.lo \
|
||||
ftextview.lo fstatusbar.lo fterm.lo fvterm.lo fevent.lo \
|
||||
foptiattr.lo foptimove.lo ftermbuffer.lo fapplication.lo \
|
||||
fwidgetcolors.lo fwidget.lo fobject.lo
|
||||
fcolorpalette.lo fwidgetcolors.lo fwidget.lo fobject.lo
|
||||
libfinal_la_OBJECTS = $(am_libfinal_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
|
@ -372,6 +372,7 @@ libfinal_la_SOURCES = \
|
|||
foptimove.cpp \
|
||||
ftermbuffer.cpp \
|
||||
fapplication.cpp \
|
||||
fcolorpalette.cpp \
|
||||
fwidgetcolors.cpp \
|
||||
fwidget.cpp \
|
||||
fobject.cpp
|
||||
|
@ -425,6 +426,7 @@ finalcutinclude_HEADERS = \
|
|||
../include/final/fvterm.h \
|
||||
../include/final/ftextview.h \
|
||||
../include/final/ftogglebutton.h \
|
||||
../include/final/fcolorpalette.h \
|
||||
../include/final/fwidgetcolors.h \
|
||||
../include/final/fwidget.h \
|
||||
../include/final/fwindow.h
|
||||
|
@ -513,6 +515,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbuttongroup.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcheckbox.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcheckmenuitem.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcolorpalette.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdialog.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdialoglistmenu.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fevent.Plo@am__quote@
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/***********************************************************************
|
||||
* fcolorpalette.cpp - Define RGB color value for a palette entry *
|
||||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
* as published by the Free Software Foundation; either version 3 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* The Final Cut 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 Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this program. If not, see *
|
||||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#include "final/fcolorpalette.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// public methods of FColorPalette
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::set8ColorPalette (funcp setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::Cyan, 0x66, 0x66, 0xff);
|
||||
setPalette (fc::Red, 0xb2, 0x18, 0x18);
|
||||
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
||||
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
||||
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::set16ColorPalette (funcp setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4);
|
||||
setPalette (fc::Red, 0xba, 0x1a, 0x1a);
|
||||
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
||||
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
||||
setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc);
|
||||
setPalette (fc::DarkGray, 0x50, 0x50, 0x50);
|
||||
setPalette (fc::LightBlue, 0x80, 0xa4, 0xec);
|
||||
setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
|
||||
setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8);
|
||||
setPalette (fc::LightRed, 0xee, 0x44, 0x44);
|
||||
setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff);
|
||||
setPalette (fc::Yellow, 0xfb, 0xe8, 0x67);
|
||||
setPalette (fc::White, 0xff, 0xff, 0xff);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::reset8ColorPalette (funcp setPalette)
|
||||
{
|
||||
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FColorPalette::reset16ColorPalette (funcp setPalette)
|
||||
{
|
||||
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
|
||||
setPalette (fc::LightGray, 0xb2, 0xb2, 0xb2);
|
||||
setPalette (fc::DarkGray, 0x68, 0x68, 0x68);
|
||||
setPalette (fc::LightBlue, 0x54, 0x54, 0xff);
|
||||
setPalette (fc::LightGreen, 0x54, 0xff, 0x54);
|
||||
}
|
|
@ -2346,7 +2346,8 @@ void FTerm::initLinuxConsole()
|
|||
// Framebuffer color depth in bits per pixel
|
||||
int bpp = getFramebuffer_bpp();
|
||||
|
||||
if ( bpp >= 4 )
|
||||
// More than 4 bits per pixel and the font uses the blink-bit
|
||||
if ( bpp >= 4 && screen_font.charcount <= 256 )
|
||||
FTermcap::max_color = 16;
|
||||
|
||||
#if DEBUG
|
||||
|
@ -4228,35 +4229,9 @@ void FTerm::redefineColorPalette()
|
|||
saveColorMap();
|
||||
|
||||
if ( FTermcap::max_color >= 16 )
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4);
|
||||
setPalette (fc::Red, 0xba, 0x1a, 0x1a);
|
||||
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
||||
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
||||
setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc);
|
||||
setPalette (fc::DarkGray, 0x50, 0x50, 0x50);
|
||||
setPalette (fc::LightBlue, 0x80, 0xa4, 0xec);
|
||||
setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
|
||||
setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8);
|
||||
setPalette (fc::LightRed, 0xee, 0x44, 0x44);
|
||||
setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff);
|
||||
setPalette (fc::Yellow, 0xfb, 0xe8, 0x67);
|
||||
setPalette (fc::White, 0xff, 0xff, 0xff);
|
||||
}
|
||||
FColorPalette::set16ColorPalette (FTerm::setPalette);
|
||||
else // 8 colors
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::Cyan, 0x66, 0x66, 0xff);
|
||||
setPalette (fc::Red, 0xb2, 0x18, 0x18);
|
||||
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
||||
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
||||
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
|
||||
}
|
||||
FColorPalette::set8ColorPalette (FTerm::setPalette);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -4270,15 +4245,9 @@ void FTerm::restoreColorPalette()
|
|||
|
||||
// Reset screen settings
|
||||
if ( FTermcap::max_color >= 16 )
|
||||
{
|
||||
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
|
||||
setPalette (fc::LightGray, 0xb2, 0xb2, 0xb2);
|
||||
setPalette (fc::DarkGray, 0x68, 0x68, 0x68);
|
||||
setPalette (fc::LightBlue, 0x54, 0x54, 0xff);
|
||||
setPalette (fc::LightGreen, 0x54, 0xff, 0x54);
|
||||
}
|
||||
FColorPalette::reset16ColorPalette (FTerm::setPalette);
|
||||
else // 8 colors
|
||||
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
|
||||
FColorPalette::reset8ColorPalette (FTerm::setPalette);
|
||||
|
||||
resetXTermColors();
|
||||
resetColorMap();
|
||||
|
|
Loading…
Reference in New Issue