github publish

This commit is contained in:
Ondrej Novak 2025-01-24 18:27:22 +01:00
commit 506e23bf32
542 changed files with 120675 additions and 0 deletions

View file

@ -0,0 +1,72 @@
// ColEdit.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ColEdit.h"
#include "ColEditDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColEditApp
BEGIN_MESSAGE_MAP(CColEditApp, CWinApp)
//{{AFX_MSG_MAP(CColEditApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColEditApp construction
CColEditApp::CColEditApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CColEditApp object
CColEditApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CColEditApp initialization
BOOL CColEditApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
/*
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
*/
CColEditDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

49
mapedit/ColEdit/ColEdit.h Normal file
View file

@ -0,0 +1,49 @@
// ColEdit.h : main header file for the COLEDIT application
//
#if !defined(AFX_COLEDIT_H__4A70A254_5D3A_4703_9034_4EE5A90DFE73__INCLUDED_)
#define AFX_COLEDIT_H__4A70A254_5D3A_4703_9034_4EE5A90DFE73__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CColEditApp:
// See ColEdit.cpp for the implementation of this class
//
class CColEditApp : public CWinApp
{
public:
CColEditApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CColEditApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CColEditApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLEDIT_H__4A70A254_5D3A_4703_9034_4EE5A90DFE73__INCLUDED_)

281
mapedit/ColEdit/ColEdit.rc Normal file
View file

@ -0,0 +1,281 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Czech resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CSY)
#ifdef _WIN32
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
#pragma code_page(1250)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\ColEdit.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\ColEdit.ico"
IDI_UP ICON "res\\icon1.ico"
IDI_DOWN ICON "res\\down.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_EDITPALETTE DIALOG 200, 0, 336, 301
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Palette"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,77,280,50,14
PUSHBUTTON "Cancel",IDCANCEL,143,280,50,14
CONTROL "",IDC_PALETA,"Static",SS_BLACKFRAME | SS_NOTIFY,7,7,322,
188
LTEXT "Barva",IDC_STATIC,7,206,20,8
CONTROL "Slider1",IDC_BARVA,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,35,204,294,15
LTEXT "Sitost",IDC_STATIC,7,226,18,8
CONTROL "Slider1",IDC_SITOST,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,35,224,294,15
LTEXT "Jas",IDC_STATIC,7,246,12,8
CONTROL "Slider1",IDC_JAS,"msctls_trackbar32",TBS_BOTH |
TBS_NOTICKS | WS_TABSTOP,35,244,294,15
PUSHBUTTON "Undo",IDC_UNDO,209,280,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_EDITPALETTE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 329
TOPMARGIN, 7
BOTTOMMARGIN, 294
HORZGUIDE, 195
END
END
#endif // APSTUDIO_INVOKED
#endif // Czech resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG 0, 0, 235, 55
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About ColEdit"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "ColEdit Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
LTEXT "Copyright (C) 2005",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_COLEDIT_DIALOG DIALOGEX 0, 0, 484, 330
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "ColEdit"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LISTBOX IDC_COLORLIST,7,7,50,152,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Insert",IDC_INSERT,7,210,50,14
PUSHBUTTON "Delete",IDC_DELETE,7,246,50,14
DEFPUSHBUTTON "Save",IDOK,7,263,50,14
PUSHBUTTON "Quit",IDCANCEL,7,309,50,14
CONTROL "",IDC_IMAGE,"Static",SS_BLACKFRAME,61,7,416,299
PUSHBUTTON "Load",IDC_LOAD,7,292,50,14
COMBOBOX IDC_IMAGESEL,372,311,105,114,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Duplicate",IDC_DUPLICATE,7,227,50,14
PUSHBUTTON "Up",IDC_UP,7,163,50,18,BS_ICON
PUSHBUTTON "Down",IDC_DOWN,7,182,50,18,BS_ICON
PUSHBUTTON "Oprav paletu",IDC_OPRAVPALETU,61,309,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_COLEDIT_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 477
VERTGUIDE, 61
TOPMARGIN, 7
BOTTOMMARGIN, 323
HORZGUIDE, 306
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "FileDescription", "ColEdit MFC Application"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "ColEdit"
VALUE "LegalCopyright", "Copyright (C) 2005"
VALUE "OriginalFilename", "ColEdit.EXE"
VALUE "ProductName", "ColEdit Application"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_ABOUTBOX "&About ColEdit..."
IDS_PALETANAME "Paleta %d"
IDS_COLFILTER "Skeldal palette list (*.col)|*.col||"
IDS_LOADFAILED "Load failed."
IDS_PALFILTER "JASC Palette (ex: IrfanView)|*.pal|All files|*.*|"
IDS_NOVAPALETA "<nové>"
IDS_SAVEFAILED "Nemohu soubor uložit"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\ColEdit.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ColEdit", "ColEdit.vcproj", "{0ED4C971-BCD5-4E05-890D-26C8E2FAE867}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{0ED4C971-BCD5-4E05-890D-26C8E2FAE867}.Debug.ActiveCfg = Debug|Win32
{0ED4C971-BCD5-4E05-890D-26C8E2FAE867}.Debug.Build.0 = Debug|Win32
{0ED4C971-BCD5-4E05-890D-26C8E2FAE867}.Release.ActiveCfg = Release|Win32
{0ED4C971-BCD5-4E05-890D-26C8E2FAE867}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,454 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="ColEdit"
ProjectGUID="{0ED4C971-BCD5-4E05-890D-26C8E2FAE867}"
SccProjectName=""
SccAuxPath=""
SccLocalPath=""
SccProvider=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\windows"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="1"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/ColEdit.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/ColEdit.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/ColEdit.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/ColEdit.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1029"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\windows"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="TRUE"
RuntimeLibrary="2"
StructMemberAlignment="1"
EnableFunctionLevelLinking="TRUE"
DefaultCharIsUnsigned="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/ColEdit.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/ColEdit.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Release/ColEdit.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/ColEdit.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1029"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="ColEdit.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="ColEdit.rc">
</File>
<File
RelativePath="ColEditDlg.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\AsyncEnvironment\CriticalSection.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="EditPaletteDlg.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Podlahar\ImageView.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="PaletteEditor.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\LIBS\PCX.C">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WPathname.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WString.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WStringMemory.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WStringProxy.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="ColEdit.h">
</File>
<File
RelativePath="ColEditDlg.h">
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\AsyncEnvironment\CriticalSection.h">
</File>
<File
RelativePath="EditPaletteDlg.h">
</File>
<File
RelativePath="..\Podlahar\ImageView.h">
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\AsyncEnvironment\Interlocked.h">
</File>
<File
RelativePath="PaletteEditor.h">
</File>
<File
RelativePath="..\..\LIBS\PCX.H">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WPathname.h">
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WString.h">
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WStringMemory.h">
</File>
<File
RelativePath="..\..\..\..\Bis\Projects\bredy.libs\WideStrings\WStringProxy.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="res\ColEdit.ico">
</File>
<File
RelativePath="res\ColEdit.rc2">
</File>
<File
RelativePath="res\down.ico">
</File>
<File
RelativePath="res\icon1.ico">
</File>
</Filter>
<File
RelativePath="ReadMe.txt">
</File>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="ColEdit.rc"/>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,489 @@
// ColEditDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ColEdit.h"
#include "ColEditDlg.h"
#include "..\..\LIBS\PCX.H"
#include "EditPaletteDlg.h"
#include "../../DDLReader/WString.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColEditDlg dialog
CColEditDlg::CColEditDlg(CWnd* pParent /*=NULL*/)
: CDialog(CColEditDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CColEditDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
_palused=0;
}
void CColEditDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CColEditDlg)
DDX_Control(pDX, IDC_UP, wUp);
DDX_Control(pDX, IDC_DOWN, wDown);
DDX_Control(pDX, IDC_IMAGESEL, wImageSel);
DDX_Control(pDX, IDC_IMAGE, wImage);
DDX_Control(pDX, IDC_COLORLIST, wColList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CColEditDlg, CDialog)
//{{AFX_MSG_MAP(CColEditDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_LOAD, OnLoad)
ON_LBN_SELCHANGE(IDC_COLORLIST, OnSelchangeColorlist)
ON_CBN_SELCHANGE(IDC_IMAGESEL, OnSelchangeImagesel)
ON_BN_CLICKED(IDC_INSERT, OnInsert)
ON_BN_CLICKED(IDC_UP, OnUp)
ON_BN_CLICKED(IDC_DOWN, OnDown)
ON_BN_CLICKED(IDC_DUPLICATE, OnDuplicate)
ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_BN_CLICKED(IDC_OPRAVPALETU, OnOpravpaletu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColEditDlg message handlers
BOOL CColEditDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
wUp.SetIcon(AfxGetApp()->LoadIcon(IDI_UP));
wDown.SetIcon(AfxGetApp()->LoadIcon(IDI_DOWN));
// TODO: Add extra initialization here
OnSelchangeColorlist();
return TRUE; // return TRUE unless you set the focus to a control
}
void CColEditDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CColEditDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CColEditDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CColEditDlg::UpdateLB()
{
CString name;
wColList.ResetContent();
for (int i=0;i<_palused;i++)
{
name.Format(IDS_PALETANAME,_indexes[i]);
wColList.AddString(name);
}
if (_palused<MAX_PALET)
{
name.LoadString(IDS_NOVAPALETA);
wColList.AddString(name);
}
}
void CColEditDlg::OnLoad()
{
CString filter;
filter.LoadString(IDS_COLFILTER);
CFileDialog fdlg(FALSE, NULL, NULL, OFN_HIDEREADONLY, filter);
if (fdlg.DoModal()==IDOK)
{
if (!LoadDocument(fdlg.GetPathName()))
{
AfxMessageBox(IDS_LOADFAILED);
return;
}
}
OnSelchangeColorlist();
}
bool CColEditDlg::LoadDocument(LPCTSTR name)
{
int i;
HANDLE f=CreateFile(name,GENERIC_READ,0,NULL,OPEN_ALWAYS,0,NULL);
if (f==NULL) return false;
DWORD sz=GetFileSize(f,NULL);
_palused=sz/(768+8);
for (i=0;i<_palused;i++)
{
DWORD temp[2];
DWORD read;
ReadFile(f,&temp,8,&read,NULL);
if (read!=8) return false;
ReadFile(f,_palety[i],768,&read,NULL);
if (read!=768) return false;
}
for (i=0;i<_palused;i++) _indexes[i]=i+1;
CloseHandle(f);
UpdateLB();
fname=name;
UpdateCB();
return true;
}
void CColEditDlg::UpdateCB()
{
CString mask=fname.Mid(0,fname.GetLength()-4);
mask=mask+_T("*.PCX");
CFileFind fnd;
wImageSel.ResetContent();
BOOL ok;
if (fnd.FindFile(mask)==TRUE) do
{
ok=fnd.FindNextFile();
wImageSel.AddString(fnd.GetFileName());
}
while (ok);
wImageSel.SetCurSel(0);
OnSelchangeImagesel();
}
void CColEditDlg::OnSelchangeColorlist()
{
OnSelchangeImagesel();
int curSel=wColList.GetCurSel();
GetDlgItem(IDC_INSERT)->EnableWindow(curSel>=0);
GetDlgItem(IDC_DUPLICATE)->EnableWindow(curSel>=0);
GetDlgItem(IDC_DELETE)->EnableWindow(curSel>=0);
GetDlgItem(IDC_UP)->EnableWindow(curSel>=0);
GetDlgItem(IDC_DOWN)->EnableWindow(curSel>=0);
GetDlgItem(IDC_OPRAVPALETU)->EnableWindow(curSel>=0);
}
extern "C"
{
void *getmem(long sz)
{
return malloc(sz);
}
}
void CColEditDlg::OnSelchangeImagesel()
{
int i=wImageSel.GetCurSel();
if (i!=-1)
{
CString pos;
wImageSel.GetLBText(i,pos);
int bsl=fname.ReverseFind('\\');
pos=fname.Mid(0,bsl+1)+pos;
char * buffer;
memset(_stbuff,0,sizeof(_stbuff));
#ifdef _UNICODE
WString pname(pos.GetString());
const char *pcxname=pname.AsUTF8(pname);
#else
const char *pcxname=pos;
#endif
if (open_pcx(const_cast<char *>(pcxname),A_8BIT,&buffer)) return;
unsigned short *xy=(unsigned short *)buffer;
for (int y=0;y<xy[1];y++)
{
memcpy(_stbuff+y*640,buffer+6+512+xy[0]*y,min(480,xy[0]));
}
int j=wColList.GetCurSel();
if (j<0) j=0;
wImage.SetPalette(_palety[j]);
wImage.UpdateBuffer(_stbuff);
free(buffer);
}
}
void CColEditDlg::OnInsert()
{
CString filter;
filter.LoadString(IDS_PALFILTER);
CFileDialog fdlg(FALSE, NULL, NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, filter);
if (fdlg.DoModal()==IDOK)
{
TCHAR buff[256];
FILE *f=_tfopen(fdlg.GetPathName(),_T("r"));
_fgetts(buff,256,f);
bool ok=false;
if (_tcscmp(buff,_T("JASC-PAL\n"))==0)
{
_fgetts(buff,256,f);
if (_tcscmp(buff,_T("0100\n"))==0)
{
_fgetts(buff,256,f);
if (_tcscmp(buff,_T("256\n"))==0)
{
int palid=DuplicateCurrent();
if (palid>=0)
{
char *p=_palety[palid];
for (int i=0;i<768;i++)
{
int item=0;
_ftscanf(f,_T("%d"),&item);
*p++=(char)item;
}
ok=true;
OnSelchangeImagesel();
}
}
}
}
fclose(f);
if (!ok)
AfxMessageBox(IDS_LOADFAILED,MB_OK);
}
}
int CColEditDlg::DuplicateCurrent()
{
int i;
int curSel=wColList.GetCurSel();
int saveCurSel=curSel;
if (curSel==_palused) curSel--;
if (curSel==-1) curSel=0;
for (i=MAX_PALET-1;i>curSel;i--)
{
memcpy(_palety[i],_palety[i-1],sizeof(_palety[i]));
_indexes[i]=_indexes[i-1];
}
_palused++;
if (_palused>MAX_PALET) _palused=MAX_PALET;
int maxnum=0;
for (i=0;i<_palused;i++)
if (_indexes[i]>maxnum) maxnum=_indexes[i];
_indexes[saveCurSel]=maxnum+1;
UpdateLB();
wColList.SetCurSel(saveCurSel);
return saveCurSel;
}
void CColEditDlg::OnUp()
{
int i;
int curSel=wColList.GetCurSel();
if (curSel<1) return;
if (curSel>=_palused) return;
i=curSel;
char buff[768];
memcpy(buff,_palety[i-1],sizeof(_palety[i]));
memcpy(_palety[i-1],_palety[i],sizeof(_palety[i]));
memcpy(_palety[i],buff,sizeof(_palety[i]));
int p=_indexes[i-1];
_indexes[i-1]=_indexes[i];
_indexes[i]=p;
curSel--;
UpdateLB();
wColList.SetCurSel(curSel);
}
void CColEditDlg::OnDown()
{
int i;
int curSel=wColList.GetCurSel();
if (curSel<0) return;
if (curSel>=_palused-1) return;
i=curSel;
char buff[768];
memcpy(buff,_palety[i+1],sizeof(_palety[i]));
memcpy(_palety[i+1],_palety[i],sizeof(_palety[i]));
memcpy(_palety[i],buff,sizeof(_palety[i]));
int p=_indexes[i+1];
_indexes[i+1]=_indexes[i];
_indexes[i]=p;
curSel++;
UpdateLB();
wColList.SetCurSel(curSel);
}
void CColEditDlg::OnDuplicate()
{
DuplicateCurrent();
OnSelchangeImagesel();
}
void CColEditDlg::OnDelete()
{
int i=wColList.GetCurSel();
if (i<0) return;
if (i>=_palused) return;
for (int p=i+1;p<_palused;p++)
{
memcpy(_palety[p-1],_palety[p],sizeof(_palety[p]));
_indexes[p-1]=_indexes[p];
}
_palused--;
UpdateLB();
OnSelchangeColorlist();
}
void CColEditDlg::OnOK()
{
if (fname=="")
{
CString filter;
filter.LoadString(IDS_COLFILTER);
CFileDialog fdlg(FALSE,_T("COL"),fname,OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT,filter);
if (fdlg.DoModal()!=IDOK) return;
fname=fdlg.GetPathName();
}
if (SaveDocument(fname)==false)
AfxMessageBox(IDS_SAVEFAILED);
}
bool CColEditDlg::SaveDocument(LPCTSTR name)
{
HANDLE h=CreateFile(name,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
if (h==INVALID_HANDLE_VALUE) return false;
for (int i=0;i<_palused;i++)
{
DWORD dummy[2]={0,0};
DWORD result=0;
WriteFile(h,&dummy,8,&result,NULL);
if (result!=8) {CloseHandle(h);return false;}
WriteFile(h,_palety[i],768,&result,NULL);
if (result!=768) {CloseHandle(h);return false;}
}
CloseHandle(h);
return true;
}
void CColEditDlg::OnOpravpaletu()
{
CEditPaletteDlg dlg;
int i=wColList.GetCurSel();
if (i<0) return;
dlg._palette=_palety[i];
dlg._imgView=&wImage;
dlg.DoModal();
}

View file

@ -0,0 +1,79 @@
// ColEditDlg.h : header file
//
#if !defined(AFX_COLEDITDLG_H__2FF53390_ECD2_468E_B1C9_60F1718D1470__INCLUDED_)
#define AFX_COLEDITDLG_H__2FF53390_ECD2_468E_B1C9_60F1718D1470__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CColEditDlg dialog
#include "..\Podlahar\ImageView.h"
#define MAX_PALET 100
class CColEditDlg : public CDialog
{
// Construction
char _palety[MAX_PALET][768];
int _palused;
int _indexes[MAX_PALET];
CString fname;
char _stbuff[640*480];
public:
bool SaveDocument(LPCTSTR name);
int DuplicateCurrent();
void UpdateCB();
bool LoadDocument(LPCTSTR name);
void UpdateLB();
CColEditDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CColEditDlg)
enum { IDD = IDD_COLEDIT_DIALOG };
CButton wUp;
CButton wDown;
CComboBox wImageSel;
CImageView wImage;
CListBox wColList;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CColEditDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CColEditDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnLoad();
afx_msg void OnSelchangeColorlist();
afx_msg void OnSelchangeImagesel();
afx_msg void OnInsert();
afx_msg void OnUp();
afx_msg void OnDown();
afx_msg void OnDuplicate();
afx_msg void OnDelete();
virtual void OnOK();
afx_msg void OnOpravpaletu();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLEDITDLG_H__2FF53390_ECD2_468E_B1C9_60F1718D1470__INCLUDED_)

View file

@ -0,0 +1,233 @@
// EditPaletteDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ColEdit.h"
#include "EditPaletteDlg.h"
#include <math.h>
#include <float.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEditPaletteDlg dialog
CEditPaletteDlg::CEditPaletteDlg(CWnd* pParent /*=NULL*/)
: CDialog(CEditPaletteDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CEditPaletteDlg)
//}}AFX_DATA_INIT
}
void CEditPaletteDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEditPaletteDlg)
DDX_Control(pDX, IDC_SITOST, wSitost);
DDX_Control(pDX, IDC_JAS, wJas);
DDX_Control(pDX, IDC_BARVA, wBarva);
DDX_Control(pDX, IDC_PALETA, wPaleta);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEditPaletteDlg, CDialog)
//{{AFX_MSG_MAP(CEditPaletteDlg)
ON_BN_CLICKED(IDC_PALETA, OnPaleta)
ON_WM_HSCROLL()
ON_BN_CLICKED(IDC_UNDO, OnUndo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditPaletteDlg message handlers
/*
RGB to HSV & HSV to RGB
The Hue/Saturation/Value model was created by A. R. Smith in 1978. It is based on such intuitive color characteristics as tint, shade and tone (or family, purety and intensity). The coordinate system is cylindrical, and the colors are defined inside a hexcone. The hue value H runs from 0 to 360o. The saturation S is the degree of strength or purity and is from 0 to 1. Purity is how much white is added to the color, so S=1 makes the purest color (no white). Brightness V also ranges from 0 to 1, where 0 is the black.
There is no transformation matrix for RGB/HSV conversion, but the algorithm follows:
*/
// r,g,b values are from 0 to 1
// h = [0,360], s = [0,1], v = [0,1]
// if s == 0, then h = -1 (undefined)
static void RGBtoHSV( float r, float g, float b, float *h, float *s, float *v )
{
float min, max, delta;
min = __min( r, __min(g, b ));
max = __max( r, __max(g, b ));
*v = max; // v
delta = max - min;
if( max != 0 )
*s = delta / max; // s
else {
// r = g = b = 0 // s = 0, v is undefined
*s = 0;
*h = -1;
return;
}
if( r == max )
*h = ( g - b ) / delta; // between yellow & magenta
else if( g == max )
*h = 2 + ( b - r ) / delta; // between cyan & yellow
else
*h = 4 + ( r - g ) / delta; // between magenta & cyan
*h *= 60; // degrees
if( *h < 0 )
*h += 360;
}
static void HSVtoRGB( float *r, float *g, float *b, float h, float s, float v )
{
int i;
float f, p, q, t;
if( s == 0 ) {
// achromatic (grey)
*r = *g = *b = v;
return;
}
h /= 60; // sector 0 to 5
i = (int)floor( h );
f = h - i; // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
t = v * ( 1 - s * ( 1 - f ) );
switch( i ) {
case 0:
*r = v;
*g = t;
*b = p;
break;
case 1:
*r = q;
*g = v;
*b = p;
break;
case 2:
*r = p;
*g = v;
*b = t;
break;
case 3:
*r = p;
*g = q;
*b = v;
break;
case 4:
*r = t;
*g = p;
*b = v;
break;
default: // case 5:
*r = v;
*g = p;
*b = q;
break;
}
}
BOOL CEditPaletteDlg::OnInitDialog()
{
CDialog::OnInitDialog();
memcpy(_paletteUndo,_palette,768);
wPaleta.SetPalette(_palette);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CEditPaletteDlg::CalculateAvgHSV()
{
float h,s,v,sh=0,ss=0,sv=0;
int cnt=0;
for (int i=0;i<256;i++) if (wPaleta.IsSelected(i))
{
RGBtoHSV(wPaleta.GetR(i)/255.0f,wPaleta.GetG(i)/255.0f,wPaleta.GetB(i)/255.0f,&h,&s,&v);
if (!_finite(h)) h=0;
sh+=h;
ss+=s;
sv+=v;
cnt++;
}
if (cnt==0) return;
sh/=cnt;
ss/=cnt;
sv/=cnt;
wBarva.SetRange(0,359);
wBarva.SetPos((int)sh);
wSitost.SetRange(0,100);
wSitost.SetPos((int)(ss*100));
wJas.SetRange(0,100);
wJas.SetPos((int)(sv*100));
_curh=sh,_curv=sv,_curs=ss;
memcpy(_paletteScrl,_palette,768);
}
void CEditPaletteDlg::OnPaleta()
{
CalculateAvgHSV();
}
void CEditPaletteDlg::OnCancel()
{
memcpy(_palette,_paletteUndo,768);
wPaleta.Invalidate(FALSE);
_imgView->SetPalette(_palette);
_imgView->Invalidate(FALSE);
CDialog::OnCancel();
}
void CEditPaletteDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
float h,s,v;
float difh=wBarva.GetPos()-_curh;
float difs=(wSitost.GetPos()/100.0f)/_curs;
float difv=(wJas.GetPos()/100.0f)/_curv;
for (int i=0;i<256;i++) if (wPaleta.IsSelected(i))
{
RGBtoHSV(_paletteScrl[i*3]/255.0f,_paletteScrl[i*3+1]/255.0f,_paletteScrl[i*3+2]/255.0f,&h,&s,&v);
if (!_finite(h)) h=0;
h+=difh;
while (h<0) {h+=360.0f;}
while (h>=360.0f) {h-=360.0f;}
if (s>0.001)
s*=difs;
else
s=wSitost.GetPos()/100.0f;
if (v>0.001)
v*=difv;
else
v=wJas.GetPos()/100.0f;
if (s<0) s=0;
if (s>1.0f) s=1.0f;
if (v<0) v=0;
if (v>1.0f) v=1.0f;
float r,g,b;
HSVtoRGB(&r,&g,&b,h,s,v);
_palette[i*3]=(int)(r*255.0f);
_palette[i*3+1]=(int)(g*255.0f);
_palette[i*3+2]=(int)(b*255.0f);
}
wPaleta.Invalidate(FALSE);
wPaleta.UpdateWindow();
_imgView->SetPalette(_palette);
_imgView->Invalidate(FALSE);
_imgView->UpdateWindow();
}
void CEditPaletteDlg::OnUndo()
{
memcpy(_palette,_paletteScrl,768);
wPaleta.Invalidate(FALSE);
_imgView->SetPalette(_palette);
_imgView->Invalidate(FALSE);
}

View file

@ -0,0 +1,63 @@
#if !defined(AFX_EDITPALETTEDLG_H__8ED55BD3_E477_4C1A_80E7_D79CDA43A55E__INCLUDED_)
#define AFX_EDITPALETTEDLG_H__8ED55BD3_E477_4C1A_80E7_D79CDA43A55E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// EditPaletteDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CEditPaletteDlg dialog
#include "PaletteEditor.h"
#include "..\Podlahar\ImageView.h"
class CEditPaletteDlg : public CDialog
{
// Construction
char _paletteUndo[768];
char _paletteScrl[768];
float _curh,_curv,_curs;
public:
CEditPaletteDlg(CWnd* pParent = NULL); // standard constructor
char *_palette;
CImageView *_imgView;
// Dialog Data
//{{AFX_DATA(CEditPaletteDlg)
enum { IDD = IDD_EDITPALETTE };
CSliderCtrl wSitost;
CSliderCtrl wJas;
CSliderCtrl wBarva;
CPaletteEditor wPaleta;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEditPaletteDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void CalculateAvgHSV();
// Generated message map functions
//{{AFX_MSG(CEditPaletteDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaleta();
virtual void OnCancel();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnUndo();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EDITPALETTEDLG_H__8ED55BD3_E477_4C1A_80E7_D79CDA43A55E__INCLUDED_)

View file

@ -0,0 +1,113 @@
// PaletteEditor.cpp : implementation file
//
#include "stdafx.h"
#include "ColEdit.h"
#include "PaletteEditor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPaletteEditor
CPaletteEditor::CPaletteEditor()
{
memset(_selection,0,sizeof(_selection));
}
CPaletteEditor::~CPaletteEditor()
{
}
BEGIN_MESSAGE_MAP(CPaletteEditor, CStatic)
//{{AFX_MSG_MAP(CPaletteEditor)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPaletteEditor message handlers
void CPaletteEditor::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rc;
GetClientRect(&rc);
char *p=_palette;
for (int i=0;i<16;i++)
for (int j=0;j<16;j++)
{
int x1=rc.right*j/16;
int y1=rc.bottom*i/16;
int x2=rc.right*(j+1)/16-1;
int y2=rc.bottom*(i+1)/16-1;
COLORREF ref=RGB(p[0],p[1],p[2]);
bool white=(p[0]*0.3+p[1]*0.5+p[2]*0.2)<128;
p+=3;
dc.FillSolidRect(x1,y1,x2-x1,y2-y1,ref);
dc.SelectStockObject(white?WHITE_PEN:BLACK_PEN);
if (!_selection[i*16+j])
{
dc.SelectStockObject(HOLLOW_BRUSH);
dc.Rectangle(x1,y1,x2,y2);
dc.MoveTo(x1,y1);dc.LineTo(x2,y2);
dc.MoveTo(x1,y2);dc.LineTo(x2,y1);
}
}
}
// Do not call CStatic::OnPaint() for painting message}
void CPaletteEditor::OnLButtonDown(UINT nFlags, CPoint point)
{
int pt=IndexFromPoint(point);
if (!(nFlags & MK_CONTROL))
memset(_selection,0,sizeof(_selection));
if (pt>=0 && pt<256)
_selection[pt]=!_selection[pt];
_drawsel=_selection[pt];
Invalidate();
SetCapture();
}
void CPaletteEditor::OnMouseMove(UINT nFlags, CPoint point)
{
if (GetCapture()==this)
{
int pt=IndexFromPoint(point);
if (pt>=0 && pt<256)
_selection[pt]=_drawsel;
Invalidate();
}
}
int CPaletteEditor::IndexFromPoint(CPoint pt)
{
CRect rc;
GetClientRect(&rc);
int x=pt.x*16/rc.right;
int y=pt.y*16/rc.bottom;
int ret=y*16+x;
return ret;
}
void CPaletteEditor::OnLButtonUp(UINT nFlags, CPoint point)
{
if (GetCapture()==this)
{
ReleaseCapture();
GetParent()->SendNotifyMessage(WM_COMMAND,MAKEWPARAM(GetDlgCtrlID(),BN_CLICKED),(LPARAM)GetSafeHwnd());
}
}

View file

@ -0,0 +1,61 @@
#if !defined(AFX_PALETTEEDITOR_H__45E6ACB6_CCFC_47F4_906C_BF0D2E76E2FE__INCLUDED_)
#define AFX_PALETTEEDITOR_H__45E6ACB6_CCFC_47F4_906C_BF0D2E76E2FE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PaletteEditor.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPaletteEditor window
class CPaletteEditor : public CStatic
{
// Construction
char *_palette;
bool _selection[256];
bool _drawsel;
public:
CPaletteEditor();
void SetPalette(char *pal) {_palette=pal;}
bool IsSelected(int p) {return _selection[p];}
int GetR(int p) {return _palette[p*3];}
int GetG(int p) {return _palette[p*3+1];}
int GetB(int p) {return _palette[p*3+2];}
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPaletteEditor)
//}}AFX_VIRTUAL
// Implementation
public:
int IndexFromPoint(CPoint pt);
virtual ~CPaletteEditor();
// Generated message map functions
protected:
//{{AFX_MSG(CPaletteEditor)
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PALETTEEDITOR_H__45E6ACB6_CCFC_47F4_906C_BF0D2E76E2FE__INCLUDED_)

View file

@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// ColEdit.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

26
mapedit/ColEdit/StdAfx.h Normal file
View file

@ -0,0 +1,26 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__5BFBE43D_BB22_424B_B397_EA20C9E39657__INCLUDED_)
#define AFX_STDAFX_H__5BFBE43D_BB22_424B_B397_EA20C9E39657__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__5BFBE43D_BB22_424B_B397_EA20C9E39657__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,13 @@
//
// COLEDIT.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View file

@ -0,0 +1,44 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by ColEdit.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_COLEDIT_DIALOG 102
#define IDS_PALETANAME 102
#define IDS_COLFILTER 103
#define IDS_LOADFAILED 104
#define IDS_PALFILTER 105
#define IDS_NOVAPALETA 106
#define IDS_SAVEFAILED 107
#define IDR_MAINFRAME 128
#define IDI_UP 129
#define IDI_DOWN 130
#define IDD_EDITPALETTE 131
#define IDC_COLORLIST 1000
#define IDC_INSERT 1001
#define IDC_DELETE 1002
#define IDC_IMAGE 1003
#define IDC_LOAD 1004
#define IDC_IMAGESEL 1005
#define IDC_DUPLICATE 1006
#define IDC_BARVA 1006
#define IDC_UP 1007
#define IDC_SITOST 1007
#define IDC_DOWN 1008
#define IDC_JAS 1008
#define IDC_PALETA 1009
#define IDC_OPRAVPALETU 1010
#define IDC_UNDO 1011
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1012
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif