From bb22e7b2a0af67cc65ce5179917b20e5977ed4ef Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Wed, 11 Jul 2012 17:09:09 +0000 Subject: MyDetails reverted to older version that doesn't use Skins plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@905 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Skins/Docs/langpack_skins.txt | 2 - plugins/Skins/Docs/skins_changelog.txt | 25 - plugins/Skins/Docs/skins_readme.txt | 31 - plugins/Skins/Docs/skins_version.txt | 1 - plugins/Skins/MirandaField.h | 14 - plugins/Skins/MirandaFont.cpp | 87 - plugins/Skins/MirandaFont.h | 28 - plugins/Skins/MirandaIconField.cpp | 19 - plugins/Skins/MirandaIconField.h | 21 - plugins/Skins/MirandaImageField.cpp | 19 - plugins/Skins/MirandaImageField.h | 21 - plugins/Skins/MirandaSkinnedDialog.cpp | 252 -- plugins/Skins/MirandaSkinnedDialog.h | 64 - plugins/Skins/MirandaTextField.cpp | 27 - plugins/Skins/MirandaTextField.h | 27 - plugins/Skins/SkinLib/BorderState.cpp | 61 - plugins/Skins/SkinLib/BorderState.h | 28 - plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp | 160 - plugins/Skins/SkinLib/BorderState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/ButtonField.cpp | 22 - plugins/Skins/SkinLib/ButtonField.h | 19 - plugins/Skins/SkinLib/ButtonFieldState.cpp | 30 - plugins/Skins/SkinLib/ButtonFieldState.h | 23 - .../Skins/SkinLib/ButtonFieldState_v8_wrapper.cpp | 20 - .../Skins/SkinLib/ButtonFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/ControlField.cpp | 123 - plugins/Skins/SkinLib/ControlField.h | 37 - plugins/Skins/SkinLib/ControlFieldState.cpp | 86 - plugins/Skins/SkinLib/ControlFieldState.h | 39 - .../Skins/SkinLib/ControlFieldState_v8_wrapper.cpp | 59 - .../Skins/SkinLib/ControlFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/Dialog.cpp | 100 - plugins/Skins/SkinLib/Dialog.h | 41 - plugins/Skins/SkinLib/DialogInfo.cpp | 190 - plugins/Skins/SkinLib/DialogInfo.h | 50 - plugins/Skins/SkinLib/DialogState.cpp | 132 - plugins/Skins/SkinLib/DialogState.h | 59 - plugins/Skins/SkinLib/DialogState_v8_wrapper.cpp | 233 -- plugins/Skins/SkinLib/DialogState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/EditField.cpp | 23 - plugins/Skins/SkinLib/EditField.h | 19 - plugins/Skins/SkinLib/EditFieldState.cpp | 58 - plugins/Skins/SkinLib/EditFieldState.h | 24 - .../Skins/SkinLib/EditFieldState_v8_wrapper.cpp | 20 - plugins/Skins/SkinLib/EditFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/Field.cpp | 56 - plugins/Skins/SkinLib/Field.h | 66 - plugins/Skins/SkinLib/FieldState.cpp | 303 -- plugins/Skins/SkinLib/FieldState.h | 108 - plugins/Skins/SkinLib/FieldState.rec | 89 - plugins/Skins/SkinLib/FieldState_v8_wrapper.cpp | 539 --- plugins/Skins/SkinLib/FieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/FontState.cpp | 186 - plugins/Skins/SkinLib/FontState.h | 57 - plugins/Skins/SkinLib/FontState_v8_wrapper.cpp | 269 -- plugins/Skins/SkinLib/FontState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/IconField.cpp | 38 - plugins/Skins/SkinLib/IconField.h | 27 - plugins/Skins/SkinLib/IconFieldState.cpp | 37 - plugins/Skins/SkinLib/IconFieldState.h | 28 - .../Skins/SkinLib/IconFieldState_v8_wrapper.cpp | 20 - plugins/Skins/SkinLib/IconFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/ImageField.cpp | 38 - plugins/Skins/SkinLib/ImageField.h | 26 - plugins/Skins/SkinLib/ImageFieldState.cpp | 37 - plugins/Skins/SkinLib/ImageFieldState.h | 28 - .../Skins/SkinLib/ImageFieldState_v8_wrapper.cpp | 20 - plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/LabelField.cpp | 23 - plugins/Skins/SkinLib/LabelField.h | 20 - plugins/Skins/SkinLib/LabelFieldState.cpp | 35 - plugins/Skins/SkinLib/LabelFieldState.h | 25 - .../Skins/SkinLib/LabelFieldState_v8_wrapper.cpp | 20 - plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/Position.cpp | 9 - plugins/Skins/SkinLib/Position.h | 16 - plugins/Skins/SkinLib/Size.cpp | 84 - plugins/Skins/SkinLib/Size.h | 27 - plugins/Skins/SkinLib/SkinOption.h | 1 - plugins/Skins/SkinLib/SkinOption_v8_wrapper.cpp | 179 - plugins/Skins/SkinLib/SkinOption_v8_wrapper.h | 10 - plugins/Skins/SkinLib/SkinOptions.cpp | 216 -- plugins/Skins/SkinLib/SkinOptions.h | 98 - plugins/Skins/SkinLib/SkinnedDialog.cpp | 235 -- plugins/Skins/SkinLib/SkinnedDialog.h | 89 - plugins/Skins/SkinLib/TextField.cpp | 78 - plugins/Skins/SkinLib/TextField.h | 35 - plugins/Skins/SkinLib/TextFieldState.cpp | 65 - plugins/Skins/SkinLib/TextFieldState.h | 38 - .../Skins/SkinLib/TextFieldState_v8_wrapper.cpp | 59 - plugins/Skins/SkinLib/TextFieldState_v8_wrapper.h | 10 - plugins/Skins/SkinLib/V8Script.cpp | 236 -- plugins/Skins/SkinLib/V8Script.h | 46 - plugins/Skins/SkinLib/V8Templates.cpp | 475 --- plugins/Skins/SkinLib/V8Templates.h | 114 - plugins/Skins/SkinLib/V8Wrappers.cpp | 385 -- plugins/Skins/SkinLib/V8Wrappers.h | 35 - plugins/Skins/SkinLib/globals.h | 20 - plugins/Skins/SkinLib/scope.h | 37 - plugins/Skins/SkinLib/tstring.h | 13 - plugins/Skins/commons.h | 119 - plugins/Skins/libs/v8-debug.h | 384 -- plugins/Skins/libs/v8.h | 3686 -------------------- plugins/Skins/libs/v8.lib | Bin 34627500 -> 0 bytes plugins/Skins/libs/v8_g.lib | Bin 40003716 -> 0 bytes plugins/Skins/options.cpp | 487 --- plugins/Skins/options.h | 47 - plugins/Skins/resource.h | 22 - plugins/Skins/resource.rc | 111 - plugins/Skins/skins.cpp | 968 ----- plugins/Skins/skins.vcproj | 1066 ------ 111 files changed, 13989 deletions(-) delete mode 100644 plugins/Skins/Docs/langpack_skins.txt delete mode 100644 plugins/Skins/Docs/skins_changelog.txt delete mode 100644 plugins/Skins/Docs/skins_readme.txt delete mode 100644 plugins/Skins/Docs/skins_version.txt delete mode 100644 plugins/Skins/MirandaField.h delete mode 100644 plugins/Skins/MirandaFont.cpp delete mode 100644 plugins/Skins/MirandaFont.h delete mode 100644 plugins/Skins/MirandaIconField.cpp delete mode 100644 plugins/Skins/MirandaIconField.h delete mode 100644 plugins/Skins/MirandaImageField.cpp delete mode 100644 plugins/Skins/MirandaImageField.h delete mode 100644 plugins/Skins/MirandaSkinnedDialog.cpp delete mode 100644 plugins/Skins/MirandaSkinnedDialog.h delete mode 100644 plugins/Skins/MirandaTextField.cpp delete mode 100644 plugins/Skins/MirandaTextField.h delete mode 100644 plugins/Skins/SkinLib/BorderState.cpp delete mode 100644 plugins/Skins/SkinLib/BorderState.h delete mode 100644 plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/BorderState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/ButtonField.cpp delete mode 100644 plugins/Skins/SkinLib/ButtonField.h delete mode 100644 plugins/Skins/SkinLib/ButtonFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/ButtonFieldState.h delete mode 100644 plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/ControlField.cpp delete mode 100644 plugins/Skins/SkinLib/ControlField.h delete mode 100644 plugins/Skins/SkinLib/ControlFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/ControlFieldState.h delete mode 100644 plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/Dialog.cpp delete mode 100644 plugins/Skins/SkinLib/Dialog.h delete mode 100644 plugins/Skins/SkinLib/DialogInfo.cpp delete mode 100644 plugins/Skins/SkinLib/DialogInfo.h delete mode 100644 plugins/Skins/SkinLib/DialogState.cpp delete mode 100644 plugins/Skins/SkinLib/DialogState.h delete mode 100644 plugins/Skins/SkinLib/DialogState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/DialogState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/EditField.cpp delete mode 100644 plugins/Skins/SkinLib/EditField.h delete mode 100644 plugins/Skins/SkinLib/EditFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/EditFieldState.h delete mode 100644 plugins/Skins/SkinLib/EditFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/EditFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/Field.cpp delete mode 100644 plugins/Skins/SkinLib/Field.h delete mode 100644 plugins/Skins/SkinLib/FieldState.cpp delete mode 100644 plugins/Skins/SkinLib/FieldState.h delete mode 100644 plugins/Skins/SkinLib/FieldState.rec delete mode 100644 plugins/Skins/SkinLib/FieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/FieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/FontState.cpp delete mode 100644 plugins/Skins/SkinLib/FontState.h delete mode 100644 plugins/Skins/SkinLib/FontState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/FontState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/IconField.cpp delete mode 100644 plugins/Skins/SkinLib/IconField.h delete mode 100644 plugins/Skins/SkinLib/IconFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/IconFieldState.h delete mode 100644 plugins/Skins/SkinLib/IconFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/IconFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/ImageField.cpp delete mode 100644 plugins/Skins/SkinLib/ImageField.h delete mode 100644 plugins/Skins/SkinLib/ImageFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/ImageFieldState.h delete mode 100644 plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/LabelField.cpp delete mode 100644 plugins/Skins/SkinLib/LabelField.h delete mode 100644 plugins/Skins/SkinLib/LabelFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/LabelFieldState.h delete mode 100644 plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/Position.cpp delete mode 100644 plugins/Skins/SkinLib/Position.h delete mode 100644 plugins/Skins/SkinLib/Size.cpp delete mode 100644 plugins/Skins/SkinLib/Size.h delete mode 100644 plugins/Skins/SkinLib/SkinOption.h delete mode 100644 plugins/Skins/SkinLib/SkinOption_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/SkinOption_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/SkinOptions.cpp delete mode 100644 plugins/Skins/SkinLib/SkinOptions.h delete mode 100644 plugins/Skins/SkinLib/SkinnedDialog.cpp delete mode 100644 plugins/Skins/SkinLib/SkinnedDialog.h delete mode 100644 plugins/Skins/SkinLib/TextField.cpp delete mode 100644 plugins/Skins/SkinLib/TextField.h delete mode 100644 plugins/Skins/SkinLib/TextFieldState.cpp delete mode 100644 plugins/Skins/SkinLib/TextFieldState.h delete mode 100644 plugins/Skins/SkinLib/TextFieldState_v8_wrapper.cpp delete mode 100644 plugins/Skins/SkinLib/TextFieldState_v8_wrapper.h delete mode 100644 plugins/Skins/SkinLib/V8Script.cpp delete mode 100644 plugins/Skins/SkinLib/V8Script.h delete mode 100644 plugins/Skins/SkinLib/V8Templates.cpp delete mode 100644 plugins/Skins/SkinLib/V8Templates.h delete mode 100644 plugins/Skins/SkinLib/V8Wrappers.cpp delete mode 100644 plugins/Skins/SkinLib/V8Wrappers.h delete mode 100644 plugins/Skins/SkinLib/globals.h delete mode 100644 plugins/Skins/SkinLib/scope.h delete mode 100644 plugins/Skins/SkinLib/tstring.h delete mode 100644 plugins/Skins/commons.h delete mode 100644 plugins/Skins/libs/v8-debug.h delete mode 100644 plugins/Skins/libs/v8.h delete mode 100644 plugins/Skins/libs/v8.lib delete mode 100644 plugins/Skins/libs/v8_g.lib delete mode 100644 plugins/Skins/options.cpp delete mode 100644 plugins/Skins/options.h delete mode 100644 plugins/Skins/resource.h delete mode 100644 plugins/Skins/resource.rc delete mode 100644 plugins/Skins/skins.cpp delete mode 100644 plugins/Skins/skins.vcproj (limited to 'plugins/Skins') diff --git a/plugins/Skins/Docs/langpack_skins.txt b/plugins/Skins/Docs/langpack_skins.txt deleted file mode 100644 index 1819d74fce..0000000000 --- a/plugins/Skins/Docs/langpack_skins.txt +++ /dev/null @@ -1,2 +0,0 @@ -; Skins -; Author: Pescuma diff --git a/plugins/Skins/Docs/skins_changelog.txt b/plugins/Skins/Docs/skins_changelog.txt deleted file mode 100644 index fcaa8da44c..0000000000 --- a/plugins/Skins/Docs/skins_changelog.txt +++ /dev/null @@ -1,25 +0,0 @@ -Skins - -Changelog: - -. 0.0.0.5 - + Allow changing skins - * Updated v8 - * Updated updater to use googlecode - -. 0.0.0.4 - * Fixed font service iteration - * Fixed naming of skin options - -. 0.0.0.3 - * Better handling of small sizes - -. 0.0.0.2 - * Fix for float numbers - + Added valign (not used yet) - + Added dialog info (allow clients to set script variables starting with info) - + The zip will contain also the pdbs (at least until it is more stable) - * Fix for ASCII strings - -. 0.0.0.1 - + Initial version \ No newline at end of file diff --git a/plugins/Skins/Docs/skins_readme.txt b/plugins/Skins/Docs/skins_readme.txt deleted file mode 100644 index fd06309ad1..0000000000 --- a/plugins/Skins/Docs/skins_readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -Skins plugin ----------------- - -CAUTION: THIS IS AN ALPHA STAGE PLUGIN. IT CAN DO VERY BAD THINGS. USE AT YOUR OWN RISK. - -This is a service plugin to allow using different skins. It uses javascript as the language the skins are written, thus allowing a lot of flexibility. - -Keep in mind that this is an initial version of the plugin. It is intended to grow a loot (its to do list is bigger than its features list :P ). Currently it allows only calculating the position of elements. - -It works based in the consept of a skin beeing a group of small skins (one for each client). The skins are inside the dir \Skins\ , and inside that folder, each client skin has the name .msk - -Inside the zip there is also a version of MyDetails using this plugin. - -Many thanks to the v8 team for the javascript engine implementation. - -This needs Miranda 0.8 to work. - -To report bugs/make suggestions, go to the forum thread: http://forums.miranda-im.org/showthread.php?p=172392 - - -TODO: - - Allow changing skin without restart - - Add support for handling skin packs - - Add support for emoticons in text fields - - Add code to draw elements on screen - - Add service to create a new frame only based on the fields - - Allow setting variables by the users of the plugin - - -KNOWN PROBLEMS: - - It seems to have a memory leak (last time I debugged it, it was inside v8 - maybe I just don't understant its garbage collector?) diff --git a/plugins/Skins/Docs/skins_version.txt b/plugins/Skins/Docs/skins_version.txt deleted file mode 100644 index 92fad2b10f..0000000000 --- a/plugins/Skins/Docs/skins_version.txt +++ /dev/null @@ -1 +0,0 @@ -Skins 0.0.0.5 \ No newline at end of file diff --git a/plugins/Skins/MirandaField.h b/plugins/Skins/MirandaField.h deleted file mode 100644 index d89901c77d..0000000000 --- a/plugins/Skins/MirandaField.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __MIRANDA_FIELD_H__ -# define __MIRANDA_FIELD_H__ - - -class MirandaField -{ -public: - virtual void configure() = 0; -}; - - - - -#endif // __MIRANDA_FIELD_H__ diff --git a/plugins/Skins/MirandaFont.cpp b/plugins/Skins/MirandaFont.cpp deleted file mode 100644 index 51b0f34f9b..0000000000 --- a/plugins/Skins/MirandaFont.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "MirandaFont.h" - -MirandaFont::MirandaFont(Field *aField, const char *description) - : field(aField), hFont(NULL) -{ - ZeroMemory(&fid, sizeof(fid)); - lstrcpyn(fid.name, CharToTchar(description), sizeof(fid.name)); -} - -MirandaFont::~MirandaFont() -{ - releaseFont(); -} - -void MirandaFont::registerFont(FontState *font) -{ - if (fid.cbSize != 0) - return; - - MirandaSkinnedDialog * dlg = (MirandaSkinnedDialog *) field->getDialog(); - - HDC hdc = GetDC(NULL); - - fid.cbSize = sizeof(fid); - lstrcpyn(fid.group, CharToTchar(dlg->getDescription()), sizeof(fid.group)); - strncpy(fid.dbSettingsGroup, dlg->getModule(), sizeof(fid.dbSettingsGroup)); - - char tmp[sizeof(fid.prefix)]; - mir_snprintf(tmp, sizeof(tmp), "%s%s%sFont", TcharToChar(dlg->getSkinName()), dlg->getName(), field->getName()); - strncpy(fid.prefix, tmp, sizeof(fid.prefix)); - - fid.deffontsettings.colour = font->getColor(); - fid.deffontsettings.size = -MulDiv(font->getSize(), GetDeviceCaps(hdc, LOGPIXELSY), 72); - fid.deffontsettings.style = (font->isBold() ? DBFONTF_BOLD : 0) - | (font->isItalic() ? DBFONTF_ITALIC : 0) - | (font->isUnderline() ? DBFONTF_UNDERLINE : 0) - | (font->isStrikeOut() ? DBFONTF_STRIKEOUT : 0); - fid.deffontsettings.charset = DEFAULT_CHARSET; - lstrcpyn(fid.deffontsettings.szFace, font->getFace(), sizeof(fid.deffontsettings.szFace)); - fid.order = dlg->getIndexOf(field); - fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; - - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); - - ReleaseDC(NULL, hdc); - - HookEventObj(ME_FONT_RELOAD, staticReloadFont, this); - - reloadFont(); -} - -void MirandaFont::reloadFont() -{ - releaseFont(); - - LOGFONT log_font; - COLORREF color = (COLORREF) CallService(MS_FONT_GETT, (WPARAM) &fid, (LPARAM) &log_font); - hFont = CreateFontIndirect(&log_font); - - switch(field->getType()) - { - case SIMPLE_TEXT: - ((TextField *) field)->setFontColor(color); - ((TextField *) field)->setFont(hFont); - break; - case CONTROL_LABEL: - case CONTROL_BUTTON: - case CONTROL_EDIT: - ((ControlField *) field)->setFont(hFont); - break; - } -} - -int MirandaFont::staticReloadFont(void *obj, WPARAM wParam, LPARAM lParam) -{ - ((MirandaFont *) obj)->reloadFont(); - return 0; -} - -void MirandaFont::releaseFont() -{ - if (hFont != NULL) - { - DeleteObject(hFont); - hFont = NULL; - } -} \ No newline at end of file diff --git a/plugins/Skins/MirandaFont.h b/plugins/Skins/MirandaFont.h deleted file mode 100644 index da9a40a06e..0000000000 --- a/plugins/Skins/MirandaFont.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __MIRANDA_FONT_H__ -# define __MIRANDA_FONT_H__ - -#include "commons.h" - - -class MirandaFont -{ -public: - MirandaFont(Field *field, const char *description); - ~MirandaFont(); - - void registerFont(FontState *font); - void reloadFont(); - -private: - FontIDT fid; - HFONT hFont; - Field *field; - - void releaseFont(); - - static int staticReloadFont(void *obj, WPARAM wParam, LPARAM lParam); -}; - - - -#endif // __MIRANDA_FONT_H__ diff --git a/plugins/Skins/MirandaIconField.cpp b/plugins/Skins/MirandaIconField.cpp deleted file mode 100644 index 7861e11091..0000000000 --- a/plugins/Skins/MirandaIconField.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "MirandaIconField.h" - -MirandaIconField::MirandaIconField(MirandaSkinnedDialog *dlg, const char *name, const char *description) - : IconField(dlg, name) -{ -} - -MirandaIconField::~MirandaIconField() -{ -} - -MirandaSkinnedDialog * MirandaIconField::getDialog() const -{ - return (MirandaSkinnedDialog *) IconField::getDialog(); -} - -void MirandaIconField::configure() -{ -} \ No newline at end of file diff --git a/plugins/Skins/MirandaIconField.h b/plugins/Skins/MirandaIconField.h deleted file mode 100644 index 0f6f15af9e..0000000000 --- a/plugins/Skins/MirandaIconField.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __MIRANDA_ICON_FIELD_H__ -# define __MIRANDA_ICON_FIELD_H__ - -#include "commons.h" -#include "MirandaField.h" - - -class MirandaIconField : public IconField, public MirandaField -{ -public: - MirandaIconField(MirandaSkinnedDialog *dlg, const char *name, const char *description); - virtual ~MirandaIconField(); - - virtual MirandaSkinnedDialog * getDialog() const; - - virtual void configure(); -}; - - - -#endif // __MIRANDA_ICON_FIELD_H__ diff --git a/plugins/Skins/MirandaImageField.cpp b/plugins/Skins/MirandaImageField.cpp deleted file mode 100644 index 2c9efe11f2..0000000000 --- a/plugins/Skins/MirandaImageField.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "MirandaImageField.h" - -MirandaImageField::MirandaImageField(MirandaSkinnedDialog *dlg, const char *name, const char *description) - : ImageField(dlg, name) -{ -} - -MirandaImageField::~MirandaImageField() -{ -} - -MirandaSkinnedDialog * MirandaImageField::getDialog() const -{ - return (MirandaSkinnedDialog *) ImageField::getDialog(); -} - -void MirandaImageField::configure() -{ -} \ No newline at end of file diff --git a/plugins/Skins/MirandaImageField.h b/plugins/Skins/MirandaImageField.h deleted file mode 100644 index 70cd1ce873..0000000000 --- a/plugins/Skins/MirandaImageField.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __MIRANDA_IMAGE_FIELD_H__ -# define __MIRANDA_IMAGE_FIELD_H__ - -#include "commons.h" -#include "MirandaField.h" - - -class MirandaImageField : public ImageField, public MirandaField -{ -public: - MirandaImageField(MirandaSkinnedDialog *dlg, const char *name, const char *description); - virtual ~MirandaImageField(); - - virtual MirandaSkinnedDialog * getDialog() const; - - virtual void configure(); -}; - - -#endif // __MIRANDA_IMAGE_FIELD_H__ - diff --git a/plugins/Skins/MirandaSkinnedDialog.cpp b/plugins/Skins/MirandaSkinnedDialog.cpp deleted file mode 100644 index 97bf236a5a..0000000000 --- a/plugins/Skins/MirandaSkinnedDialog.cpp +++ /dev/null @@ -1,252 +0,0 @@ -#include "commons.h" -#include "MirandaSkinnedDialog.h" - -#define SETTING_NAME_SIZE 256 - - -MirandaSkinnedDialog::MirandaSkinnedDialog(const char *name, const char *aDescription, const char *aModule) - : SkinnedDialog(name), description(aDescription), module(aModule), - skinChangedCallback(NULL), skinChangedCallbackParam(NULL) -{ - getSettting("Skin", _T(DEFAULT_SKIN_NAME), skinName, true); -} - -MirandaSkinnedDialog::~MirandaSkinnedDialog() -{ -} - -const char * MirandaSkinnedDialog::getDescription() const -{ - return description.c_str(); -} - -const char * MirandaSkinnedDialog::getModule() const -{ - return module.c_str(); -} - -const TCHAR * MirandaSkinnedDialog::getSkinName() const -{ - return skinName.c_str(); -} - -void MirandaSkinnedDialog::setSkinName(const TCHAR *name) -{ - if (skinName == name) - return; - - skinName = name; - setSettting("Skin", skinName.c_str(), true); - updateFilename(); -} - -bool MirandaSkinnedDialog::finishedConfiguring() -{ - updateFilename(); - - if (getDefaultState() == NULL || getOpts() == NULL) - return false; - - return true; -} - -void MirandaSkinnedDialog::updateFilename() -{ - std::tstring filename; - getSkinnedDialogFilename(filename, getSkinName(), getName()); - setFilename(filename.c_str()); -} - -void MirandaSkinnedDialog::loadFromDB(SkinOption *opt) -{ - switch(opt->getType()) - { - case CHECKBOX: - { - opt->setValueCheckbox(getSettting(opt->getName(), opt->getValueCheckbox())); - break; - } - case NUMBER: - { - opt->setValueNumber(getSettting(opt->getName(), opt->getValueNumber())); - break; - } - case TEXT: - { - std::tstring tmp; - getSettting(opt->getName(), opt->getValueText(), tmp); - opt->setValueText(tmp.c_str()); - break; - } - } -} - -void MirandaSkinnedDialog::storeToDB(const SkinOptions *opts) -{ - for (unsigned int i = 0; i < opts->getNumOptions(); i++) - storeToDB(opts->getOption(i)); - - fireOnSkinChanged(); -} - -void MirandaSkinnedDialog::storeToDB(const SkinOption *opt) -{ - switch(opt->getType()) - { - case CHECKBOX: - { - setSettting(opt->getName(), opt->getValueCheckbox()); - break; - } - case NUMBER: - { - setSettting(opt->getName(), opt->getValueNumber()); - break; - } - case TEXT: - { - setSettting(opt->getName(), opt->getValueText()); - break; - } - } -} - -bool MirandaSkinnedDialog::getSettting(const char *name, bool defVal, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - return DBGetContactSettingByte(NULL, getModule(), setting, defVal ? 1 : 0) != 0; -} - -void MirandaSkinnedDialog::setSettting(const char *name, bool val, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - DBWriteContactSettingByte(NULL, getModule(), setting, val ? 1 : 0); -} - -int MirandaSkinnedDialog::getSettting(const char *name, int defVal, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - return DBGetContactSettingDword(NULL, getModule(), setting, defVal); -} - -void MirandaSkinnedDialog::setSettting(const char *name, int val, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - DBWriteContactSettingDword(NULL, getModule(), setting, val); -} - -void MirandaSkinnedDialog::getSettting(const char *name, const WCHAR *defVal, std::wstring &ret, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - DBVARIANT dbv = {0}; - if (DBGetContactSettingWString(NULL, getModule(), setting, &dbv)) - { - ret = defVal; - return; - } - - ret = dbv.pwszVal; - DBFreeVariant(&dbv); -} - -void MirandaSkinnedDialog::setSettting(const char *name, const WCHAR *val, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - DBWriteContactSettingWString(NULL, getModule(), setting, val); -} - -void MirandaSkinnedDialog::getSettting(const char *name, const char *defVal, std::string &ret, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - DBVARIANT dbv = {0}; - if (DBGetContactSettingString(NULL, getModule(), setting, &dbv)) - { - ret = defVal; - return; - } - - ret = dbv.pszVal; - DBFreeVariant(&dbv); -} - -void MirandaSkinnedDialog::setSettting(const char *name, const char *val, bool global) -{ - char setting[SETTING_NAME_SIZE]; - getSettingName(setting, name, global); - - DBWriteContactSettingString(NULL, getModule(), setting, val); -} - -void MirandaSkinnedDialog::getSettingName(char *setting, const char * name, bool global) -{ - if (global) - mir_snprintf(setting, SETTING_NAME_SIZE, "%s%s", getName(), name); - else - mir_snprintf(setting, SETTING_NAME_SIZE, "%s%s%s", TcharToChar(getSkinName()), getName(), name); -} - -void MirandaSkinnedDialog::setOnSkinChangedCallback(MirandaSkinnedCallback cb, void *param) -{ - skinChangedCallback = cb; - skinChangedCallbackParam = param; -} - -void MirandaSkinnedDialog::fireOnSkinChanged() -{ - if (skinChangedCallback != NULL) - skinChangedCallback(skinChangedCallbackParam, this); -} - -int MirandaSkinnedDialog::compile() -{ - int ret = SkinnedDialog::compile(); - - if (ret == 2) - { - SkinOptions * opts = getOpts(); - _ASSERT(opts != NULL); - - for(unsigned int i = 0; i < opts->getNumOptions(); ++i) - { - SkinOption *opt = opts->getOption(i); - loadFromDB(opt); - opt->setOnChangeCallback(&staticOnOptionChange, this); - } - - for(unsigned int i = 0; i < getFieldCount(); ++i) - { - MirandaField *field = dynamic_cast(getField(i)); - field->configure(); - } - - fireOnSkinChanged(); - } - - return ret; -} - -void MirandaSkinnedDialog::onOptionChange(const SkinOption *opt) -{ - storeToDB(opt); -} - -void MirandaSkinnedDialog::staticOnOptionChange(void *param, const SkinOption *opt) -{ - _ASSERT(param != NULL); - - ((MirandaSkinnedDialog *) param)->onOptionChange(opt); -} diff --git a/plugins/Skins/MirandaSkinnedDialog.h b/plugins/Skins/MirandaSkinnedDialog.h deleted file mode 100644 index d556b9a495..0000000000 --- a/plugins/Skins/MirandaSkinnedDialog.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __MIRANDA_SKINNED_DIALOG_H__ -# define __MIRANDA_SKINNED_DIALOG_H__ - -#include "SkinLib\SkinnedDialog.h" - -class SkinOption; -class MirandaSkinnedDialog; - -typedef void (*MirandaSkinnedCallback)(void *param, const MirandaSkinnedDialog *dlg); - - -class MirandaSkinnedDialog : public SkinnedDialog -{ -public: - MirandaSkinnedDialog(const char *name, const char *description, const char *module); - virtual ~MirandaSkinnedDialog(); - - virtual const char * getDescription() const; - virtual const char * getModule() const; - - virtual const TCHAR * getSkinName() const; - virtual void setSkinName(const TCHAR *name); - - virtual bool finishedConfiguring(); - - virtual void storeToDB(const SkinOptions *opts); - - virtual void setOnSkinChangedCallback(MirandaSkinnedCallback cb, void *param); - -protected: - virtual int compile(); - -private: - std::string description; - std::string module; - std::tstring skinName; - MirandaSkinnedCallback skinChangedCallback; - void *skinChangedCallbackParam; - - void updateFilename(); - - void loadFromDB(SkinOption *opt); - void storeToDB(const SkinOption *opt); - - bool getSettting(const char *name, bool defVal, bool global = false); - void setSettting(const char *name, bool val, bool global = false); - int getSettting(const char *name, int defVal, bool global = false); - void setSettting(const char *name, int val, bool global = false); - void getSettting(const char *name, const WCHAR *defVal, std::wstring &ret, bool global = false); - void setSettting(const char *name, const WCHAR *val, bool global = false); - void getSettting(const char *name, const char *defVal, std::string &ret, bool global = false); - void setSettting(const char *name, const char *val, bool global = false); - - inline void getSettingName(char *setting, const char * name, bool global); - - void fireOnSkinChanged(); - - void onOptionChange(const SkinOption *opt); - - static void staticOnOptionChange(void *param, const SkinOption *opt); -}; - - -#endif // __MIRANDA_SKINNED_DIALOG_H__ diff --git a/plugins/Skins/MirandaTextField.cpp b/plugins/Skins/MirandaTextField.cpp deleted file mode 100644 index 4a3591a322..0000000000 --- a/plugins/Skins/MirandaTextField.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "MirandaTextField.h" -#include "MirandaFont.h" - - -MirandaTextField::MirandaTextField(MirandaSkinnedDialog *dlg, const char *name, const char *aDescription) - : TextField(dlg, name) -{ - font = new MirandaFont(this, aDescription); -} - -MirandaTextField::~MirandaTextField() -{ - delete font; -} - -MirandaSkinnedDialog * MirandaTextField::getDialog() const -{ - return (MirandaSkinnedDialog *) TextField::getDialog(); -} - -void MirandaTextField::configure() -{ - TextFieldState *field = (TextFieldState *) getDialog()->getDefaultState()->getField(getName()); - _ASSERT(field != NULL); - - font->registerFont(field->getFont()); -} diff --git a/plugins/Skins/MirandaTextField.h b/plugins/Skins/MirandaTextField.h deleted file mode 100644 index 36b7ea7292..0000000000 --- a/plugins/Skins/MirandaTextField.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __MIRANDA_TEXT_FIELD_H__ -# define __MIRANDA_TEXT_FIELD_H__ - -#include "commons.h" -#include "MirandaField.h" - -class MirandaFont; - - -class MirandaTextField : public TextField, public MirandaField -{ -public: - MirandaTextField(MirandaSkinnedDialog *dlg, const char *name, const char *description); - virtual ~MirandaTextField(); - - virtual MirandaSkinnedDialog * getDialog() const; - - virtual void configure(); - -private: - MirandaFont *font; - -}; - - - -#endif // __MIRANDA_TEXT_FIELD_H__ diff --git a/plugins/Skins/SkinLib/BorderState.cpp b/plugins/Skins/SkinLib/BorderState.cpp deleted file mode 100644 index 83dcdbcf11..0000000000 --- a/plugins/Skins/SkinLib/BorderState.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "globals.h" -#include -#include "BorderState.h" - -BorderState::BorderState(int aLeft, int aRight, int aTop, int aBottom) - : left(aLeft), right(aRight), top(aTop), bottom(aBottom) -{ -} - -BorderState::~BorderState() -{ -} - -int BorderState::getLeft() const -{ - return left; -} - -void BorderState::setLeft(int left) -{ - this->left = max(0, left); -} - -int BorderState::getRight() const -{ - return right; -} - -void BorderState::setRight(int right) -{ - this->right = max(0, right); -} - -int BorderState::getTop() const -{ - return top; -} - -void BorderState::setTop(int top) -{ - this->top = max(0, top); -} - -int BorderState::getBottom() const -{ - return bottom; -} - -void BorderState::setBottom(int bottom) -{ - this->bottom = max(0, bottom); -} - -void BorderState::setAll(int border) -{ - border = max(0, border); - left = border; - right = border; - top = border; - bottom = border; -} diff --git a/plugins/Skins/SkinLib/BorderState.h b/plugins/Skins/SkinLib/BorderState.h deleted file mode 100644 index 2cac3c1aa5..0000000000 --- a/plugins/Skins/SkinLib/BorderState.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -class BorderState -{ -public: - BorderState(int left, int right, int top, int bottom); - ~BorderState(); - - int getLeft() const; - void setLeft(int left); - - int getRight() const; - void setRight(int right); - - int getTop() const; - void setTop(int top); - - int getBottom() const; - void setBottom(int bottom); - - void setAll(int border); - -private: - int left; - int right; - int top; - int bottom; -}; diff --git a/plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp b/plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp deleted file mode 100644 index 71cc057419..0000000000 --- a/plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp +++ /dev/null @@ -1,160 +0,0 @@ -#include "globals.h" -#include "BorderState_v8_wrapper.h" -#include -#include "BorderState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_BorderState_left(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getLeft()) ); -} - -static void Set_BorderState_left(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setLeft(value->Int32Value()); -} - - -static Handle Get_BorderState_right(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getRight()) ); -} - -static void Set_BorderState_right(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setRight(value->Int32Value()); -} - - -static Handle Get_BorderState_top(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getTop()) ); -} - -static void Set_BorderState_top(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setTop(value->Int32Value()); -} - - -static Handle Get_BorderState_bottom(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getBottom()) ); -} - -static void Set_BorderState_bottom(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - BorderState *tmp = (BorderState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setBottom(value->Int32Value()); -} - - -void AddBorderStateAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("left"), Get_BorderState_left, Set_BorderState_left); - templ->SetAccessor(String::New("right"), Get_BorderState_right, Set_BorderState_right); - templ->SetAccessor(String::New("top"), Get_BorderState_top, Set_BorderState_top); - templ->SetAccessor(String::New("bottom"), Get_BorderState_bottom, Set_BorderState_bottom); -} diff --git a/plugins/Skins/SkinLib/BorderState_v8_wrapper.h b/plugins/Skins/SkinLib/BorderState_v8_wrapper.h deleted file mode 100644 index 70af9e41dc..0000000000 --- a/plugins/Skins/SkinLib/BorderState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BORDER_STATE_V8_WRAPPER_H__ -# define __BORDER_STATE_V8_WRAPPER_H__ - -#include - -void AddBorderStateAcessors(v8::Handle &templ); - - - -#endif // __BORDER_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/ButtonField.cpp b/plugins/Skins/SkinLib/ButtonField.cpp deleted file mode 100644 index e6c82ba5e3..0000000000 --- a/plugins/Skins/SkinLib/ButtonField.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "globals.h" -#include "ButtonField.h" -#include "ButtonFieldState.h" - - -ButtonField::ButtonField(Dialog *dlg, const char *name, HWND hwnd) : ControlField(dlg, name, hwnd) -{ -} - -ButtonField::~ButtonField() -{ -} - -FieldType ButtonField::getType() const -{ - return CONTROL_BUTTON; -} - -FieldState * ButtonField::createState(DialogState *dialogState) -{ - return new ButtonFieldState(dialogState, this); -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ButtonField.h b/plugins/Skins/SkinLib/ButtonField.h deleted file mode 100644 index 0d7a1555ca..0000000000 --- a/plugins/Skins/SkinLib/ButtonField.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __BUTTON_FIELD_H__ -# define __BUTTON_FIELD_H__ - -#include "ControlField.h" - -class ButtonField : public ControlField -{ -public: - ButtonField(Dialog *dlg, const char *name, HWND hwnd); - virtual ~ButtonField(); - - virtual FieldType getType() const; - - virtual FieldState * createState(DialogState *dialogState); -}; - - - -#endif // __BUTTON_FIELD_H__ diff --git a/plugins/Skins/SkinLib/ButtonFieldState.cpp b/plugins/Skins/SkinLib/ButtonFieldState.cpp deleted file mode 100644 index 986484b20b..0000000000 --- a/plugins/Skins/SkinLib/ButtonFieldState.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "globals.h" -#include "ButtonFieldState.h" - -ButtonFieldState::ButtonFieldState(DialogState *dialog, ControlField *field) - : ControlFieldState(dialog, field) -{ -} - -ButtonFieldState::~ButtonFieldState() -{ -} - -Size ButtonFieldState::getPreferedSize() const -{ - Size ret = getTextPreferedSize(DT_SINGLELINE); - - int border = getField()->getBorderSize(); - ret.x += 2 * border; - ret.y += 2 * border; - - ret.x += 12; - ret.y += 10; - - return ret; -} - -bool ButtonFieldState::isEmpty() const -{ - return false; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ButtonFieldState.h b/plugins/Skins/SkinLib/ButtonFieldState.h deleted file mode 100644 index 12b701035a..0000000000 --- a/plugins/Skins/SkinLib/ButtonFieldState.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __BUTTON_FIELD_STATE_H__ -# define __BUTTON_FIELD_STATE_H__ - -#include "ControlFieldState.h" - - -class ButtonFieldState : public ControlFieldState -{ -public: - virtual ~ButtonFieldState(); - - virtual Size getPreferedSize() const; - - virtual bool isEmpty() const; - -private: - ButtonFieldState(DialogState *dialog, ControlField *field); - - friend class ButtonField; -}; - - -#endif // __BUTTON_FIELD_STATE_H__ diff --git a/plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.cpp deleted file mode 100644 index c5916b284c..0000000000 --- a/plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "globals.h" -#include "ButtonFieldState_v8_wrapper.h" -#include -#include "ButtonFieldState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -void AddButtonFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - -} diff --git a/plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.h deleted file mode 100644 index c69fdc5c87..0000000000 --- a/plugins/Skins/SkinLib/ButtonFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __BUTTON_FIELD_STATE_V8_WRAPPER_H__ -# define __BUTTON_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddButtonFieldStateAcessors(v8::Handle &templ); - - - -#endif // __BUTTON_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/ControlField.cpp b/plugins/Skins/SkinLib/ControlField.cpp deleted file mode 100644 index dd9d7026d9..0000000000 --- a/plugins/Skins/SkinLib/ControlField.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include "globals.h" -#include "ControlField.h" -#include "ControlFieldState.h" - - -ControlField::ControlField(Dialog *dlg, const char *name, HWND aHwnd) - : Field(dlg, name), hwnd(aHwnd), textSet(false), hFont(NULL) -{ -} - - -ControlField::~ControlField() -{ -} - - -HWND ControlField::getHWND() -{ - return hwnd; -} - - - -void ControlField::setText(const TCHAR *text) -{ - if (text == NULL) - { - if (!textSet) - return; - - textSet = false; - this->text.clear(); - fireOnChange(); - } - else - { - textSet = true; - if (this->text == text) - return; - - this->text = text; - // SetWindowText(hwnd, text); - fireOnChange(); - } -} - - -const TCHAR * ControlField::getText() -{ - if (textSet) - return text.c_str(); - - // Control text is the default value - int length = GetWindowTextLength(hwnd); - if (length <= 0) - { - text = _T(""); - } - else - { - TCHAR *tmp = new TCHAR[length+1]; - - if (GetWindowText(hwnd, tmp, length+1) == 0) - tmp[0] = 0; - - text = tmp; - - delete[] tmp; - } - - return text.c_str(); -} - - -void ControlField::setFont(HFONT hFont) -{ - if (this->hFont == hFont) - return; - - this->hFont = hFont; -// SendMessage(hwnd, WM_SETFONT, (WPARAM) hFont, FALSE); - fireOnChange(); -} - - -HFONT ControlField::getFont() const -{ - if (hFont != NULL) - return hFont; - - // Control font is the default value - return (HFONT) SendMessage(hwnd, WM_GETFONT, 0, 0); -} - - -COLORREF ControlField::getFontColor() const -{ - return GetSysColor(COLOR_WINDOWTEXT); -} - - -int ControlField::getBorderSize() const -{ - int exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); - if (exstyle & WS_EX_CLIENTEDGE) - return GetSystemMetrics(SM_CXEDGE); - if (exstyle & WS_EX_STATICEDGE) - return GetSystemMetrics(SM_CXBORDER); - - int style = GetWindowLong(hwnd, GWL_STYLE); - if (style & WS_BORDER) - return GetSystemMetrics(SM_CXBORDER); - - return 0; -} - -bool ControlField::isScrollVisible(bool horizontal) const -{ - SCROLLBARINFO sbi = {0}; - sbi.cbSize = sizeof(SCROLLBARINFO); - GetScrollBarInfo(hwnd, horizontal ? OBJID_HSCROLL : OBJID_VSCROLL, &sbi); - return (sbi.rgstate[0] & STATE_SYSTEM_INVISIBLE) == 0; -} diff --git a/plugins/Skins/SkinLib/ControlField.h b/plugins/Skins/SkinLib/ControlField.h deleted file mode 100644 index 014ee04b9b..0000000000 --- a/plugins/Skins/SkinLib/ControlField.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __LABEL_CONTROL_FIELD_H__ -# define __LABEL_CONTROL_FIELD_H__ - -#include "Field.h" - -class ControlField : public Field -{ -public: - ControlField(Dialog *dlg, const char *name, HWND hwnd); - virtual ~ControlField(); - - virtual HWND getHWND(); - - virtual void setText(const TCHAR *text); - virtual const TCHAR * getText(); - - virtual void setFont(HFONT hFont); - virtual HFONT getFont() const; - - virtual COLORREF getFontColor() const; - - virtual int getBorderSize() const; - - virtual bool isScrollVisible(bool horizontal) const; - -private: - HWND hwnd; - - bool textSet; - std::tstring text; - - HFONT hFont; -}; - - - -#endif // __LABEL_CONTROL_FIELD_H__ diff --git a/plugins/Skins/SkinLib/ControlFieldState.cpp b/plugins/Skins/SkinLib/ControlFieldState.cpp deleted file mode 100644 index 37c412058a..0000000000 --- a/plugins/Skins/SkinLib/ControlFieldState.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "globals.h" -#include "ControlFieldState.h" - - -ControlFieldState::ControlFieldState(DialogState *dialog, ControlField *field) - : FieldState(dialog, field), textSet(false), font(field->getFont(), field->getFontColor()) -{ -} - - -ControlFieldState::~ControlFieldState() -{ -} - - -ControlField * ControlFieldState::getField() const -{ - return (ControlField *) FieldState::getField(); -} - - -Size ControlFieldState::getTextPreferedSize(unsigned int format) const -{ - HDC hdc = CreateCompatibleDC(NULL); - - HFONT newFont = getFont()->getHFONT(); - HFONT oldFont = (HFONT) SelectObject(hdc, newFont); - - int width = 0; - int height = 0; - - const TCHAR *text = getText(); - int len = lstrlen(text); - if (len <= 0) - { - TEXTMETRIC tm = {0}; - GetTextMetrics(hdc, &tm); - height = tm.tmHeight; - } - else - { - RECT rc = {0}; - if ((format & DT_SINGLELINE) == 0 && size.x >= 0) - { - format |= DT_WORDBREAK; - rc.right = size.x; - } - DrawText(hdc, text, len, &rc, DT_CALCRECT | format); - width = rc.right - rc.left; - height = rc.bottom - rc.top; - } - - SelectObject(hdc, oldFont); - - DeleteDC(hdc); - - return Size(width, height); -} - - -const TCHAR * ControlFieldState::getText() const -{ - if (textSet) - return text.c_str(); - - return getField()->getText(); -} - - -void ControlFieldState::setText(const TCHAR *text) -{ - this->text = text; - textSet = true; -} - - -FontState * ControlFieldState::getFont() -{ - return &font; -} - - -const FontState * ControlFieldState::getFont() const -{ - return &font; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ControlFieldState.h b/plugins/Skins/SkinLib/ControlFieldState.h deleted file mode 100644 index 85186c304a..0000000000 --- a/plugins/Skins/SkinLib/ControlFieldState.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __LABEL_CONTROL_FIELD_STATE_H__ -# define __LABEL_CONTROL_FIELD_STATE_H__ - -#include "ControlField.h" -#include "FieldState.h" -#include "FontState.h" - - -class ControlFieldState : public FieldState -{ -public: - virtual ~ControlFieldState(); - - virtual ControlField * getField() const; - - virtual Size getPreferedSize() const = 0; - - virtual const TCHAR * getText() const; - virtual void setText(const TCHAR *text); - - virtual FontState * getFont(); - virtual const FontState * getFont() const; - -protected: - ControlFieldState(DialogState *dialog, ControlField *field); - - virtual Size getTextPreferedSize(unsigned int format) const; - -private: - FontState font; - - bool textSet; - std::tstring text; - - friend class ControlField; -}; - - -#endif // __LABEL_CONTROL_FIELD_STATE_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp deleted file mode 100644 index 70d3e06a45..0000000000 --- a/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "globals.h" -#include "ControlFieldState_v8_wrapper.h" -#include -#include "ControlFieldState.h" -#include - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_ControlFieldState_text(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - ControlFieldState *tmp = (ControlFieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( String::New((const V8_TCHAR *) tmp->getText()) ); -} - -static void Set_ControlFieldState_text(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - ControlFieldState *tmp = (ControlFieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - tmp->setText(Utf8ToTchar(*utf8_value)); - } -} - - -void AddControlFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("text"), Get_ControlFieldState_text, Set_ControlFieldState_text); -} diff --git a/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.h deleted file mode 100644 index c86964ce30..0000000000 --- a/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __CONTROL_FIELD_STATE_V8_WRAPPER_H__ -# define __CONTROL_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddControlFieldStateAcessors(v8::Handle &templ); - - - -#endif // __CONTROL_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/Dialog.cpp b/plugins/Skins/SkinLib/Dialog.cpp deleted file mode 100644 index edc8437817..0000000000 --- a/plugins/Skins/SkinLib/Dialog.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "globals.h" -#include "Dialog.h" -#include "DialogState.h" - - -Dialog::Dialog(const char *aName) : name(aName) -{ -} - - -Dialog::~Dialog() -{ - for(unsigned int i = 0; i < fields.size(); i++) - delete fields[i]; - - fields.clear(); -} - - -const char * Dialog::getName() const -{ - return name.c_str(); -} - - -bool Dialog::addField(Field *field) -{ - if (getField(field->getName()) != NULL) - return false; - - fields.push_back(field); - return true; -} - - -Field * Dialog::getField(const char *name) const -{ - if (name == NULL || name[0] == 0) - return NULL; - - for(unsigned int i = 0; i < fields.size(); i++) - { - Field *field = fields[i]; - if (strcmp(name, field->getName()) == 0) - return field; - } - - return NULL; -} - -Field * Dialog::getField(unsigned int pos) const -{ - if (pos >= fields.size()) - return NULL; - return fields[pos]; -} - -int Dialog::getIndexOf(Field *field) const -{ - for(unsigned int i = 0; i < fields.size(); i++) - { - Field *f = fields[i]; - if (field == f) - return i; - } - - return -1; -} - -unsigned int Dialog::getFieldCount() const -{ - return fields.size(); -} - -DialogInfo * Dialog::getInfo() -{ - return &info; -} - -const Size & Dialog::getSize() const -{ - return size; -} - - -void Dialog::setSize(const Size &size) -{ - this->size = size; -} - - -DialogState * Dialog::createState() -{ - DialogState *ret = new DialogState(this); - - for(unsigned int i = 0; i < fields.size(); i++) - ret->fields.push_back(fields[i]->createState(ret)); - - return ret; -} diff --git a/plugins/Skins/SkinLib/Dialog.h b/plugins/Skins/SkinLib/Dialog.h deleted file mode 100644 index 0e85b8e340..0000000000 --- a/plugins/Skins/SkinLib/Dialog.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __DIALOG_H__ -# define __DIALOG_H__ - -#include -#include "Field.h" -#include "DialogInfo.h" - -class DialogState; - - -/// It is responsible for freeing the Fields -class Dialog -{ -public: - Dialog(const char *name); - virtual ~Dialog(); - - virtual const char * getName() const; - - virtual bool addField(Field *field); - virtual Field * getField(const char *name) const; - virtual Field * getField(unsigned int pos) const; - virtual int getIndexOf(Field *field) const; - virtual unsigned int getFieldCount() const; - - virtual DialogInfo * getInfo(); - - virtual const Size & getSize() const; - virtual void setSize(const Size &size); - - virtual DialogState * createState(); - -private: - const std::string name; - std::vector fields; - DialogInfo info; - Size size; -}; - - -#endif // __DIALOG_H__ diff --git a/plugins/Skins/SkinLib/DialogInfo.cpp b/plugins/Skins/SkinLib/DialogInfo.cpp deleted file mode 100644 index fd29a37392..0000000000 --- a/plugins/Skins/SkinLib/DialogInfo.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "globals.h" -#include "DialogInfo.h" -#include "tstring.h" - -class DialogInfoValue -{ -public: - DialogInfoValue(const char *aName) : name(aName), type(UNKNOWN) {} - - const char * getName() { return name.c_str(); } - - void set(const TCHAR *value) { valueString = value; type = TYPE_STRING; } - void set(int value) { valueInt = value; type = TYPE_INT; } - void set(double value) { valueDouble = value; type = TYPE_DOUBLE; } - void set(bool value) { valueBool = value; type = TYPE_BOOL; } - - DialogInfoType getType() { return type; } - - const TCHAR * getAsString() { return valueString.c_str(); } - int getAsInt() { return valueInt; } - double getAsDouble() { return valueDouble; } - bool getAsBool() { return valueBool; } - -private: - std::string name; - - DialogInfoType type; - - std::tstring valueString; - int valueInt; - double valueDouble; - bool valueBool; -}; - -DialogInfo::DialogInfo() -{ -} - -DialogInfo::~DialogInfo() -{ - for(size_t i = 0; i < values.size(); ++i) - delete values[i]; -} - - -void DialogInfo::set(const char *name, const TCHAR *value) -{ - bool isVar; - DialogInfoValue * val = findValue(name, true, &isVar); - - if (isVar) - return; - - val->set(value); -} - -void DialogInfo::set(const char *name, int value) -{ - bool isVar; - DialogInfoValue * val = findValue(name, true, &isVar); - - if (isVar) - return; - - val->set(value); -} - -void DialogInfo::set(const char *name, double value) -{ - bool isVar; - DialogInfoValue * val = findValue(name, true, &isVar); - - if (isVar) - return; - - val->set(value); -} - -void DialogInfo::set(const char *name, bool value) -{ - bool isVar; - DialogInfoValue * val = findValue(name, true, &isVar); - - if (isVar) - return; - - val->set(value); -} - -void DialogInfo::remove(const char *name) -{ - size_t len = strlen(name); - - for(std::vector::iterator it = values.begin(); it != values.end(); ) - { - DialogInfoValue *val = *it; - - if (stricmp(name, val->getName()) == 0) - it = values.erase(it); - - else if (strnicmp(name, val->getName(), len) == 0 && val->getName()[len] == '.') - it = values.erase(it); - - else - it++; - } -} - -DialogInfoType DialogInfo::getType(const char *name) -{ - bool isVar; - DialogInfoValue * val = findValue(name, false, &isVar); - - if (isVar) - return TYPE_VARIABLE; - - else if (val == NULL) - return UNKNOWN; - - else - return val->getType(); -} - - -const TCHAR * DialogInfo::getAsString(const char *name) -{ - DialogInfoValue * val = findValue(name); - if (val == NULL) - return NULL; - - return val->getAsString(); -} - -int DialogInfo::getAsInt(const char *name) -{ - DialogInfoValue * val = findValue(name); - if (val == NULL) - return 0; - - return val->getAsInt(); -} - -double DialogInfo::getAsDouble(const char *name) -{ - DialogInfoValue * val = findValue(name); - if (val == NULL) - return 0; - - return val->getAsDouble(); -} - -bool DialogInfo::getAsBool(const char *name) -{ - DialogInfoValue * val = findValue(name); - if (val == NULL) - return false; - - return val->getAsBool(); -} - -DialogInfoValue * DialogInfo::findValue(const char *name, bool create, bool *isVar) -{ - size_t len = strlen(name); - - if (isVar != NULL) *isVar = false; - - for(size_t i = 0; i < values.size(); ++i) - { - DialogInfoValue *val = values[i]; - - if (stricmp(name, val->getName()) == 0) - { - return val; - } - else if (strnicmp(name, val->getName(), len) == 0 && val->getName()[len] == '.') - { - if (isVar != NULL) *isVar = true; - return val; - } - } - - if (create) - { - DialogInfoValue *ret = new DialogInfoValue(name); - values.push_back(ret); - return ret; - } - - return NULL; -} diff --git a/plugins/Skins/SkinLib/DialogInfo.h b/plugins/Skins/SkinLib/DialogInfo.h deleted file mode 100644 index 02f07310d7..0000000000 --- a/plugins/Skins/SkinLib/DialogInfo.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef __DIALOG_INFO_H__ -# define __DIALOG_INFO_H__ - -#include -#include - - -enum DialogInfoType -{ - UNKNOWN = 0, - TYPE_VARIABLE, - TYPE_INT, - TYPE_DOUBLE, - TYPE_BOOL, - TYPE_STRING -}; - - -class DialogInfoValue; - -class DialogInfo -{ -public: - DialogInfo(); - ~DialogInfo(); - - void set(const char *name, const TCHAR *value); - void set(const char *name, int value); - void set(const char *name, double value); - void set(const char *name, bool value); - - void remove(const char *name); - - DialogInfoType getType(const char *name); - - const TCHAR * getAsString(const char *name); - int getAsInt(const char *name); - double getAsDouble(const char *name); - bool getAsBool(const char *name); - -private: - std::vector values; - - DialogInfoValue * findValue(const char *name, bool create = false, bool *isVar = NULL); - -}; - - - -#endif // __DIALOG_INFO_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/DialogState.cpp b/plugins/Skins/SkinLib/DialogState.cpp deleted file mode 100644 index e1e7654930..0000000000 --- a/plugins/Skins/SkinLib/DialogState.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "globals.h" -#include "DialogState.h" - - -DialogState::DialogState(Dialog *aDialog) : dialog(aDialog), size(-1,-1), borders(0,0,0,0) -{ -} - -DialogState::~DialogState() -{ - for(unsigned int i = 0; i < fields.size(); i++) - delete fields[i]; - - fields.clear(); -} - -Dialog * DialogState::getDialog() const -{ - return dialog; -} - -FieldState * DialogState::getField(const char *name) const -{ - if (name == NULL || name[0] == 0) - return NULL; - - for(unsigned int i = 0; i < fields.size(); i++) - { - FieldState *field = fields[i]; - if (strcmp(name, field->getField()->getName()) == 0) - return field; - } - - return NULL; -} - -int DialogState::getX() const -{ - return 0; -} - -int DialogState::getY() const -{ - return 0; -} - -int DialogState::getLeft() const -{ - return getX(); -} - -int DialogState::getTop() const -{ - return getY(); -} - -int DialogState::getRight() const -{ - return getX() + getWidth(); -} - -int DialogState::getBottom() const -{ - return getY() + getHeight(); -} - -int DialogState::getWidth() const -{ - if (size.x >= 0) - return size.x - getHorizontalBorders(); - - return dialog->getSize().x - getHorizontalBorders(); -} - -void DialogState::setWidth(int width) -{ - size.x = max(0, width) + getHorizontalBorders(); -} - -int DialogState::getHeight() const -{ - if (size.y >= 0) - return size.y - getVerticalBorders(); - - return dialog->getSize().y - getVerticalBorders(); -} - -void DialogState::setHeight(int height) -{ - size.y = max(0, height) + getVerticalBorders(); -} - -BorderState * DialogState::getBorders() -{ - return &borders; -} - -const BorderState * DialogState::getBorders() const -{ - return &borders; -} - -int DialogState::getHorizontalBorders() const -{ - return borders.getLeft() + borders.getRight(); -} - -int DialogState::getVerticalBorders() const -{ - return borders.getTop() + borders.getBottom(); -} - -RECT DialogState::getInsideRect() const -{ - RECT ret; - ret.left = borders.getLeft(); - ret.right = ret.left + getWidth(); - ret.top = borders.getTop(); - ret.bottom = ret.top + getHeight(); - return ret; -} - -RECT DialogState::getRect() const -{ - RECT ret; - ret.left = 0; - ret.right = borders.getLeft() + getWidth() + borders.getRight(); - ret.top = 0; - ret.bottom = borders.getTop() + getHeight() + borders.getBottom(); - return ret; -} - diff --git a/plugins/Skins/SkinLib/DialogState.h b/plugins/Skins/SkinLib/DialogState.h deleted file mode 100644 index e27fc929da..0000000000 --- a/plugins/Skins/SkinLib/DialogState.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __DIALOG_STATE_H__ -# define __DIALOG_STATE_H__ - -#include "Dialog.h" -#include "FieldState.h" -#include "BorderState.h" - - -/// This have to be deleted before the owning dialog -/// It is responsible for freeing the FieldStates -class DialogState -{ -public: - ~DialogState(); - - Dialog * getDialog() const; - - std::vector fields; - FieldState * getField(const char *name) const; - - // Used inside script - - virtual int getX() const; - virtual int getY() const; - virtual int getLeft() const; - virtual int getTop() const; - virtual int getRight() const; - virtual int getBottom() const; - - int getWidth() const; - void setWidth(int width); - - int getHeight() const; - void setHeight(int height); - - BorderState * getBorders(); - const BorderState * getBorders() const; - - // Results - - RECT getInsideRect() const; - RECT getRect() const; - -private: - DialogState(Dialog *dialog); - - Dialog *dialog; - - Size size; - BorderState borders; - - int getHorizontalBorders() const; - int getVerticalBorders() const; - - friend class Dialog; -}; - - -#endif // __DIALOG_STATE_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/DialogState_v8_wrapper.cpp b/plugins/Skins/SkinLib/DialogState_v8_wrapper.cpp deleted file mode 100644 index 5739414d69..0000000000 --- a/plugins/Skins/SkinLib/DialogState_v8_wrapper.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "globals.h" -#include "DialogState_v8_wrapper.h" -#include -#include "DialogState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_DialogState_width(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getWidth()) ); -} - -static void Set_DialogState_width(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setWidth(value->Int32Value()); -} - - -static Handle Get_DialogState_height(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getHeight()) ); -} - -static void Set_DialogState_height(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setHeight(value->Int32Value()); -} - - -static Handle Get_DialogState_x(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getX()) ); -} - - -static Handle Get_DialogState_y(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getY()) ); -} - - -static Handle Get_DialogState_left(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getLeft()) ); -} - - -static Handle Get_DialogState_top(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getTop()) ); -} - - -static Handle Get_DialogState_right(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getRight()) ); -} - - -static Handle Get_DialogState_bottom(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getBottom()) ); -} - - -static Handle Get_DialogState_borders(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( self->Get(String::New("bordersRaw")) ); -} - -static void Set_DialogState_borders(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - DialogState *tmp = (DialogState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsInt32()) - tmp->getBorders()->setAll(value->Int32Value()); -} - - -void AddDialogStateAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("width"), Get_DialogState_width, Set_DialogState_width); - templ->SetAccessor(String::New("height"), Get_DialogState_height, Set_DialogState_height); - templ->SetAccessor(String::New("x"), Get_DialogState_x, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("y"), Get_DialogState_y, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("left"), Get_DialogState_left, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("top"), Get_DialogState_top, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("right"), Get_DialogState_right, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("bottom"), Get_DialogState_bottom, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("borders"), Get_DialogState_borders, Set_DialogState_borders); -} diff --git a/plugins/Skins/SkinLib/DialogState_v8_wrapper.h b/plugins/Skins/SkinLib/DialogState_v8_wrapper.h deleted file mode 100644 index 709ef2d738..0000000000 --- a/plugins/Skins/SkinLib/DialogState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __DIALOG_STATE_V8_WRAPPER_H__ -# define __DIALOG_STATE_V8_WRAPPER_H__ - -#include - -void AddDialogStateAcessors(v8::Handle &templ); - - - -#endif // __DIALOG_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/EditField.cpp b/plugins/Skins/SkinLib/EditField.cpp deleted file mode 100644 index 8eb0d5050f..0000000000 --- a/plugins/Skins/SkinLib/EditField.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "globals.h" -#include "EditField.h" -#include "EditFieldState.h" - - -EditField::EditField(Dialog *dlg, const char *name, HWND hwnd) - : ControlField(dlg, name, hwnd) -{ -} - -EditField::~EditField() -{ -} - -FieldType EditField::getType() const -{ - return CONTROL_EDIT; -} - -FieldState * EditField::createState(DialogState *dialogState) -{ - return new EditFieldState(dialogState, this); -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/EditField.h b/plugins/Skins/SkinLib/EditField.h deleted file mode 100644 index f69f23576c..0000000000 --- a/plugins/Skins/SkinLib/EditField.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __EDIT_FIELD_H__ -# define __EDIT_FIELD_H__ - -#include "ControlField.h" - - -class EditField : public ControlField -{ -public: - EditField(Dialog *dlg, const char *name, HWND hwnd); - virtual ~EditField(); - - virtual FieldType getType() const; - - virtual FieldState * createState(DialogState *dialogState); -}; - - -#endif // __EDIT_FIELD_H__ diff --git a/plugins/Skins/SkinLib/EditFieldState.cpp b/plugins/Skins/SkinLib/EditFieldState.cpp deleted file mode 100644 index e634be7b55..0000000000 --- a/plugins/Skins/SkinLib/EditFieldState.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "globals.h" -#include "EditFieldState.h" - - -EditFieldState::EditFieldState(DialogState *dialog, EditField *field) - : ControlFieldState(dialog, field) -{ -} - -EditFieldState::~EditFieldState() -{ -} - -Size EditFieldState::getPreferedSize() const -{ - ControlField *field = getField(); - HWND hwnd = field->getHWND(); - - int style = GetWindowLong(hwnd, GWL_STYLE); - int exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); - - int format = DT_NOPREFIX | DT_EDITCONTROL; - if (!(style & ES_MULTILINE)) - format |= DT_SINGLELINE; - Size ret = getTextPreferedSize(format); - - RECT rc = {0}; - SetRect(&rc, 0, 0, ret.x, ret.y); - AdjustWindowRectEx(&rc, style, false, exstyle); - - bool hasHorScroll = field->isScrollVisible(true); - if (hasHorScroll) - rc.bottom += GetSystemMetrics(SM_CYHSCROLL); - if (field->isScrollVisible(false)) - rc.right += GetSystemMetrics(SM_CXVSCROLL); - - int margins = SendMessage(hwnd, EM_GETMARGINS, 0, 0); - rc.left -= LOWORD(margins); - rc.right += HIWORD(margins); - if (hasHorScroll || (style & ES_AUTOHSCROLL)) - rc.right++; - - ret.x = rc.right - rc.left; - ret.y = rc.bottom - rc.top; - - if ((exstyle & WS_EX_CLIENTEDGE) || (exstyle & WS_EX_STATICEDGE) || (style & WS_BORDER)) - { - ret.x += 3; - ret.y += 3; - } - - return ret; -} - -bool EditFieldState::isEmpty() const -{ - return false; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/EditFieldState.h b/plugins/Skins/SkinLib/EditFieldState.h deleted file mode 100644 index c2372d553d..0000000000 --- a/plugins/Skins/SkinLib/EditFieldState.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __EDIT_FIELD_STATE_H__ -# define __EDIT_FIELD_STATE_H__ - -#include "ControlFieldState.h" -#include "EditField.h" - - -class EditFieldState : public ControlFieldState -{ -public: - virtual ~EditFieldState(); - - virtual Size getPreferedSize() const; - - virtual bool isEmpty() const; - -private: - EditFieldState(DialogState *dialog, EditField *field); - - friend class EditField; -}; - - -#endif // __EDIT_FIELD_STATE_H__ diff --git a/plugins/Skins/SkinLib/EditFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/EditFieldState_v8_wrapper.cpp deleted file mode 100644 index 86522b87e3..0000000000 --- a/plugins/Skins/SkinLib/EditFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "globals.h" -#include "EditFieldState_v8_wrapper.h" -#include -#include "EditFieldState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -void AddEditFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - -} diff --git a/plugins/Skins/SkinLib/EditFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/EditFieldState_v8_wrapper.h deleted file mode 100644 index a58972549f..0000000000 --- a/plugins/Skins/SkinLib/EditFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __EDIT_FIELD_STATE_V8_WRAPPER_H__ -# define __EDIT_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddEditFieldStateAcessors(v8::Handle &templ); - - - -#endif // __EDIT_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/Field.cpp b/plugins/Skins/SkinLib/Field.cpp deleted file mode 100644 index 24b823bde6..0000000000 --- a/plugins/Skins/SkinLib/Field.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "globals.h" -#include "Field.h" -#include "FieldState.h" - - -Field::Field(Dialog *aDlg, const char *aName) - : dlg(aDlg), name(aName), onChangeCallback(NULL), onChangeCallbackParam(NULL), enabled(true) -{ -} - -Field::~Field() -{ -} - -Dialog * Field::getDialog() const -{ - return dlg; -} - -const char * Field::getName() const -{ - return name.c_str(); -} - -bool Field::isEnabled() const -{ - return enabled; -} - -void Field::setEnabled(bool enabled) -{ - this->enabled = enabled; - fireOnChange(); -} - -const TCHAR * Field::getToolTip() const -{ - return tooltip.c_str(); -} - -void Field::setToolTip(const TCHAR *tooltip) -{ - this->tooltip = tooltip; -} - -void Field::setOnChangeCallback(FieldCallback cb, void *param /*= NULL*/) -{ - onChangeCallback = cb; - onChangeCallbackParam = param; -} - -void Field::fireOnChange() const -{ - if (onChangeCallback != NULL) - onChangeCallback(onChangeCallbackParam, this); -} diff --git a/plugins/Skins/SkinLib/Field.h b/plugins/Skins/SkinLib/Field.h deleted file mode 100644 index 4cf7faaa51..0000000000 --- a/plugins/Skins/SkinLib/Field.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __FIELD_H__ -# define __FIELD_H__ - -#include -#include -#include "tstring.h" -#include "Size.h" -#include "Position.h" - - -enum FieldType -{ - SIMPLE_TEXT = 1, - SIMPLE_IMAGE, - SIMPLE_ICON, - CONTROL_LABEL, - CONTROL_BUTTON, - CONTROL_EDIT, - USER_DEFINED = 0x100 -}; - -class Dialog; -class DialogState; -class Field; -class FieldState; - -typedef void (*FieldCallback)(void *param, const Field *field); - - -class Field -{ -public: - Field(Dialog *dlg, const char *name); - virtual ~Field(); - - virtual Dialog * getDialog() const; - virtual const char * getName() const; - virtual FieldType getType() const = 0; - - virtual bool isEnabled() const; - virtual void setEnabled(bool enabled); - - virtual const TCHAR * getToolTip() const; - virtual void setToolTip(const TCHAR *tooltip); - - virtual FieldState * createState(DialogState *dialogState) = 0; - - virtual void setOnChangeCallback(FieldCallback cb, void *param = NULL); - -protected: - void fireOnChange() const; - -private: - Dialog *dlg; - const std::string name; - bool enabled; - std::tstring tooltip; - - FieldCallback onChangeCallback; - void *onChangeCallbackParam; -}; - - - - -#endif // __FIELD_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/FieldState.cpp b/plugins/Skins/SkinLib/FieldState.cpp deleted file mode 100644 index 68510051da..0000000000 --- a/plugins/Skins/SkinLib/FieldState.cpp +++ /dev/null @@ -1,303 +0,0 @@ -#include "globals.h" -#include "FieldState.h" -#include "DialogState.h" -#include "BorderState.h" - -#define START 1<<0 -#define LEN 1<<1 -#define END 1<<2 -#define USING_MASK 0xFF -#define LAST_SHIFT 8 -#define SET(_FIELD_, _ITEM_) _FIELD_ = (((_FIELD_ | _ITEM_) & USING_MASK) | (_ITEM_ << LAST_SHIFT)) -#define LAST_SET(_FIELD_) (_FIELD_ >> LAST_SHIFT) - - -FieldState::FieldState(DialogState *aDialog, Field *aField) - : field(aField), dialog(aDialog), size(-1, -1), pos(0, 0), - usingX(0), usingY(0), visible(aField->isEnabled()), borders(0,0,0,0), - tooltipSet(false), halign(HORIZONTAL_ALIGN_LEFT), valign(VERTICAL_ALIGN_TOP) -{ -} - -FieldState::~FieldState() -{ -} - -Field * FieldState::getField() const -{ - return field; -} - -DialogState * FieldState::getDialog() const -{ - return dialog; -} - -int FieldState::getX() const -{ - return pos.x; -} - -void FieldState::setX(int x) -{ - if (usingX & END) - { - int diff = x - getX(); - size.x = max(0, getWidth() - getHorizontalBorders() - diff); - } - - pos.x = x; - - SET(usingX, START); -} - -int FieldState::getY() const -{ - return pos.y; -} - -void FieldState::setY(int y) -{ - if (usingY & END) - { - int diff = y - getY(); - size.y = max(0, getHeight() - getVerticalBorders() - diff); - } - - pos.y = y; - - SET(usingY, START); -} - -int FieldState::getWidth() const -{ - if (size.x >= 0) - return size.x + getHorizontalBorders(); - - return getPreferedSize().x + getHorizontalBorders(); -} - -void FieldState::setWidth(int width) -{ - width = max(0, width - getHorizontalBorders()) + getHorizontalBorders(); - - if (LAST_SET(usingX) == END) - { - int diff = width - getWidth(); - pos.x = getX() - diff; - } - - size.x = width - getHorizontalBorders(); - - usingX |= LEN; -} - -int FieldState::getHeight() const -{ - if (size.y >= 0) - return size.y + getVerticalBorders(); - - return getPreferedSize().y + getVerticalBorders(); -} - -void FieldState::setHeight(int height) -{ - height = max(0, height - getVerticalBorders()) + getVerticalBorders(); - - if (LAST_SET(usingY) == END) - { - int diff = height - getHeight(); - pos.y = getY() - diff; - } - - size.y = height - getVerticalBorders(); - - usingY |= LEN; -} - -bool FieldState::isVisible() const -{ - if (!visible) - return false; - - RECT rc = getRect(); - if (rc.right <= rc.left || rc.bottom <= rc.top) - return false; - - return true; -} - -void FieldState::setVisible(bool visible) -{ - this->visible = visible; -} - -bool FieldState::isEnabled() const -{ - return field->isEnabled(); -} - -int FieldState::getLeft() const -{ - return getX(); -} - -void FieldState::setLeft(int left) -{ - setX(left); -} - -int FieldState::getTop() const -{ - return getY(); -} - -void FieldState::setTop(int top) -{ - setY(top); -} - -int FieldState::getRight() const -{ - return getX() + getWidth(); -} - -void FieldState::setRight(int right) -{ - if (usingX & START) - { - size.x = max(0, right - getX()); - } - else - { - pos.x = right - getWidth(); - } - - SET(usingX, END); -} - -int FieldState::getBottom() const -{ - return getY() + getHeight(); -} - -void FieldState::setBottom(int botom) -{ - if (usingY & START) - { - size.y = max(0, botom - getY()); - } - else - { - pos.y = botom - getHeight(); - } - - SET(usingY, END); -} - -const TCHAR * FieldState::getToolTip() const -{ - if (tooltipSet) - return tooltip.c_str(); - else - return field->getToolTip(); -} - -void FieldState::setToolTip(const TCHAR *tooltip) -{ - this->tooltip = tooltip; - tooltipSet = true; -} - -BorderState * FieldState::getBorders() -{ - return &borders; -} - -const BorderState * FieldState::getBorders() const -{ - return &borders; -} - -int FieldState::getHorizontalBorders() const -{ - return borders.getLeft() + borders.getRight(); -} - -int FieldState::getVerticalBorders() const -{ - return borders.getTop() + borders.getBottom(); -} - -static inline int beetween(int val, int minVal, int maxVal) -{ - return max(minVal, min(maxVal, val)); -} - -static inline void intersection(RECT &main, const RECT &other) -{ - main.left = beetween(main.left, other.left, other.right); - main.right = beetween(main.right, other.left, other.right); - main.top = beetween(main.top, other.top, other.bottom); - main.bottom = beetween(main.bottom, other.top, other.bottom); -} - -RECT FieldState::getRect(bool raw) const -{ - RECT ret = {0}; - - if (!visible) - return ret; - - RECT inside = dialog->getInsideRect(); - - ret.left = getLeft() + inside.left; - ret.right = getRight() + inside.left; - ret.top = getTop() + inside.top; - ret.bottom = getBottom() + inside.top; - - if (!raw) - intersection(ret, inside); - - return ret; -} - -RECT FieldState::getInsideRect(bool raw) const -{ - RECT ret = {0}; - - if (!visible) - return ret; - - RECT inside = dialog->getInsideRect(); - - ret.left = getLeft() + borders.getLeft() + inside.left; - ret.right = getRight() - borders.getRight() + inside.left; - ret.top = getTop() + borders.getTop() + inside.top; - ret.bottom = getBottom() - borders.getBottom() + inside.top; - - if (!raw) - intersection(ret, inside); - - return ret; -} - -HORIZONTAL_ALIGN FieldState::getHAlign() const -{ - return halign; -} - -void FieldState::setHAlign(HORIZONTAL_ALIGN halign) -{ - this->halign = halign; -} - -VERTICAL_ALIGN FieldState::getVAlign() const -{ - return valign; -} - -void FieldState::setVAlign(VERTICAL_ALIGN valign) -{ - this->valign = valign; -} diff --git a/plugins/Skins/SkinLib/FieldState.h b/plugins/Skins/SkinLib/FieldState.h deleted file mode 100644 index d7c552105f..0000000000 --- a/plugins/Skins/SkinLib/FieldState.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef __FIELD_STATE_H__ -# define __FIELD_STATE_H__ - -#include "Field.h" -#include "BorderState.h" - -class DialogState; - -enum HORIZONTAL_ALIGN -{ - HORIZONTAL_ALIGN_LEFT = 1, - HORIZONTAL_ALIGN_CENTER, - HORIZONTAL_ALIGN_RIGHT -}; - -enum VERTICAL_ALIGN -{ - VERTICAL_ALIGN_TOP = 1, - VERTICAL_ALIGN_CENTER, - VERTICAL_ALIGN_BOTTOM -}; - - -class FieldState -{ -public: - virtual ~FieldState(); - - virtual Field * getField() const; - virtual DialogState * getDialog() const; - - virtual Size getPreferedSize() const = 0; - - // Used inside script - - virtual int getX() const; - virtual void setX(int x); - - virtual int getY() const; - virtual void setY(int y); - - virtual int getWidth() const; - virtual void setWidth(int width); - - virtual int getHeight() const; - virtual void setHeight(int height); - - virtual int getLeft() const; - virtual void setLeft(int left); - - virtual int getTop() const; - virtual void setTop(int top); - - virtual int getRight() const; - virtual void setRight(int right); - - virtual int getBottom() const; - virtual void setBottom(int bottom); - - virtual bool isVisible() const; - virtual void setVisible(bool visible); - - virtual bool isEnabled() const; - - virtual const TCHAR * getToolTip() const; - virtual void setToolTip(const TCHAR *tooltip); - - virtual BorderState * getBorders(); - virtual const BorderState * getBorders() const; - - virtual HORIZONTAL_ALIGN getHAlign() const; - virtual void setHAlign(HORIZONTAL_ALIGN halign); - - virtual VERTICAL_ALIGN getVAlign() const; - virtual void setVAlign(VERTICAL_ALIGN valign); - - virtual bool isEmpty() const = 0; - - // Results - - virtual RECT getInsideRect(bool raw = false) const; - virtual RECT getRect(bool raw = false) const; - -protected: - FieldState(DialogState *dialog, Field *field); - - Field *field; - DialogState *dialog; - - Size size; - Position pos; - int usingX; - int usingY; - bool visible; - BorderState borders; - bool tooltipSet; - std::tstring tooltip; - HORIZONTAL_ALIGN halign; - VERTICAL_ALIGN valign; - - int getHorizontalBorders() const; - int getVerticalBorders() const; - - friend class Field; -}; - - -#endif // __FIELD_STATE_H__ diff --git a/plugins/Skins/SkinLib/FieldState.rec b/plugins/Skins/SkinLib/FieldState.rec deleted file mode 100644 index 7b9ffd890d..0000000000 --- a/plugins/Skins/SkinLib/FieldState.rec +++ /dev/null @@ -1,89 +0,0 @@ -struct DialogState -{ - Int32 width; - Int32 height; - const Int32 x; - const Int32 y; - const Int32 left; - const Int32 top; - const Int32 right; - const Int32 bottom; - BorderState borders [setter: if (!value.IsEmpty() && value->IsInt32())\n\ttmp->getBorders()->setAll(value->Int32Value()); ]; -}; - -struct FieldState -{ - Int32 x; - Int32 y; - Int32 width; - Int32 height; - Int32 left; - Int32 top; - Int32 right; - Int32 bottom; - Boolean visible; - const Boolean enabled; - Char toolTip[128]; - Int32 hAlign | HORIZONTAL_ALIGN_LEFT "LEFT" | HORIZONTAL_ALIGN_CENTER "CENTER" | HORIZONTAL_ALIGN_RIGHT "RIGHT"; - Int32 vAlign | VERTICAL_ALIGN_TOP "TOP" | VERTICAL_ALIGN_CENTER "CENTER" | VERTICAL_ALIGN_BOTTOM "BOTTOM"; - BorderState borders [setter: if (!value.IsEmpty() && value->IsInt32())\n\ttmp->getBorders()->setAll(value->Int32Value()); ]; -}; - -struct ControlFieldState : FieldState -{ - Char text[1024]; - FontState font; -}; - -struct LabelFieldState : ControlFieldState -{ -}; - -struct ButtonFieldState : ControlFieldState -{ -}; - -struct EditFieldState : ControlFieldState -{ -}; - -struct IconFieldState : FieldState -{ -}; - -struct ImageFieldState : FieldState -{ -}; - -struct TextFieldState : FieldState -{ - Char text[1024]; - FontState font; -}; - -struct FontState -{ - Char face[32]; - Int32 size; - Boolean italic; - Boolean bold; - Boolean underline; - Boolean strikeOut; - Int32 color; -}; - -struct BorderState -{ - Int32 left; - Int32 right; - Int32 top; - Int32 bottom; -}; - -struct SkinOption -{ - Char description[128]; - Int32 min; - Int32 max; - Int32 type | CHECKBOX | NUMBER | TEXT; -}; diff --git a/plugins/Skins/SkinLib/FieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/FieldState_v8_wrapper.cpp deleted file mode 100644 index 937ad69a58..0000000000 --- a/plugins/Skins/SkinLib/FieldState_v8_wrapper.cpp +++ /dev/null @@ -1,539 +0,0 @@ -#include "globals.h" -#include "FieldState_v8_wrapper.h" -#include -#include "FieldState.h" -#include - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_FieldState_x(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getX()) ); -} - -static void Set_FieldState_x(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setX(value->Int32Value()); -} - - -static Handle Get_FieldState_y(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getY()) ); -} - -static void Set_FieldState_y(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setY(value->Int32Value()); -} - - -static Handle Get_FieldState_width(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getWidth()) ); -} - -static void Set_FieldState_width(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setWidth(value->Int32Value()); -} - - -static Handle Get_FieldState_height(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getHeight()) ); -} - -static void Set_FieldState_height(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setHeight(value->Int32Value()); -} - - -static Handle Get_FieldState_left(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getLeft()) ); -} - -static void Set_FieldState_left(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setLeft(value->Int32Value()); -} - - -static Handle Get_FieldState_top(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getTop()) ); -} - -static void Set_FieldState_top(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setTop(value->Int32Value()); -} - - -static Handle Get_FieldState_right(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getRight()) ); -} - -static void Set_FieldState_right(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setRight(value->Int32Value()); -} - - -static Handle Get_FieldState_bottom(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getBottom()) ); -} - -static void Set_FieldState_bottom(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setBottom(value->Int32Value()); -} - - -static Handle Get_FieldState_visible(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Boolean::New(tmp->isVisible()) ); -} - -static void Set_FieldState_visible(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsBoolean()) - tmp->setVisible(value->BooleanValue()); -} - - -static Handle Get_FieldState_enabled(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Boolean::New(tmp->isEnabled()) ); -} - - -static Handle Get_FieldState_toolTip(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( String::New((const V8_TCHAR *) tmp->getToolTip()) ); -} - -static void Set_FieldState_toolTip(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - tmp->setToolTip(Utf8ToTchar(*utf8_value)); - } -} - - -static Handle Get_FieldState_hAlign(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - switch(tmp->getHAlign()) - { - case HORIZONTAL_ALIGN_LEFT: return scope.Close( String::New((const V8_TCHAR *) _T("LEFT")) ); - case HORIZONTAL_ALIGN_CENTER: return scope.Close( String::New((const V8_TCHAR *) _T("CENTER")) ); - case HORIZONTAL_ALIGN_RIGHT: return scope.Close( String::New((const V8_TCHAR *) _T("RIGHT")) ); - } - return scope.Close( Undefined() ); -} - -static void Set_FieldState_hAlign(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - Utf8ToTchar tval(*utf8_value); - if ( lstrcmpi(_T("HORIZONTAL_ALIGN_LEFT"), tval) == 0 ) - tmp->setHAlign(HORIZONTAL_ALIGN_LEFT); - else if ( lstrcmpi(_T("LEFT"), tval) == 0 ) - tmp->setHAlign(HORIZONTAL_ALIGN_LEFT); - else if ( lstrcmpi(_T("HORIZONTAL_ALIGN_CENTER"), tval) == 0 ) - tmp->setHAlign(HORIZONTAL_ALIGN_CENTER); - else if ( lstrcmpi(_T("CENTER"), tval) == 0 ) - tmp->setHAlign(HORIZONTAL_ALIGN_CENTER); - else if ( lstrcmpi(_T("HORIZONTAL_ALIGN_RIGHT"), tval) == 0 ) - tmp->setHAlign(HORIZONTAL_ALIGN_RIGHT); - else if ( lstrcmpi(_T("RIGHT"), tval) == 0 ) - tmp->setHAlign(HORIZONTAL_ALIGN_RIGHT); - } -} - - -static Handle Get_FieldState_vAlign(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - switch(tmp->getVAlign()) - { - case VERTICAL_ALIGN_TOP: return scope.Close( String::New((const V8_TCHAR *) _T("TOP")) ); - case VERTICAL_ALIGN_CENTER: return scope.Close( String::New((const V8_TCHAR *) _T("CENTER")) ); - case VERTICAL_ALIGN_BOTTOM: return scope.Close( String::New((const V8_TCHAR *) _T("BOTTOM")) ); - } - return scope.Close( Undefined() ); -} - -static void Set_FieldState_vAlign(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - Utf8ToTchar tval(*utf8_value); - if ( lstrcmpi(_T("VERTICAL_ALIGN_TOP"), tval) == 0 ) - tmp->setVAlign(VERTICAL_ALIGN_TOP); - else if ( lstrcmpi(_T("TOP"), tval) == 0 ) - tmp->setVAlign(VERTICAL_ALIGN_TOP); - else if ( lstrcmpi(_T("VERTICAL_ALIGN_CENTER"), tval) == 0 ) - tmp->setVAlign(VERTICAL_ALIGN_CENTER); - else if ( lstrcmpi(_T("CENTER"), tval) == 0 ) - tmp->setVAlign(VERTICAL_ALIGN_CENTER); - else if ( lstrcmpi(_T("VERTICAL_ALIGN_BOTTOM"), tval) == 0 ) - tmp->setVAlign(VERTICAL_ALIGN_BOTTOM); - else if ( lstrcmpi(_T("BOTTOM"), tval) == 0 ) - tmp->setVAlign(VERTICAL_ALIGN_BOTTOM); - } -} - - -static Handle Get_FieldState_borders(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( self->Get(String::New("bordersRaw")) ); -} - -static void Set_FieldState_borders(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FieldState *tmp = (FieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsInt32()) - tmp->getBorders()->setAll(value->Int32Value()); -} - - -void AddFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("x"), Get_FieldState_x, Set_FieldState_x); - templ->SetAccessor(String::New("y"), Get_FieldState_y, Set_FieldState_y); - templ->SetAccessor(String::New("width"), Get_FieldState_width, Set_FieldState_width); - templ->SetAccessor(String::New("height"), Get_FieldState_height, Set_FieldState_height); - templ->SetAccessor(String::New("left"), Get_FieldState_left, Set_FieldState_left); - templ->SetAccessor(String::New("top"), Get_FieldState_top, Set_FieldState_top); - templ->SetAccessor(String::New("right"), Get_FieldState_right, Set_FieldState_right); - templ->SetAccessor(String::New("bottom"), Get_FieldState_bottom, Set_FieldState_bottom); - templ->SetAccessor(String::New("visible"), Get_FieldState_visible, Set_FieldState_visible); - templ->SetAccessor(String::New("enabled"), Get_FieldState_enabled, NULL, Handle(), DEFAULT, ReadOnly); - templ->SetAccessor(String::New("toolTip"), Get_FieldState_toolTip, Set_FieldState_toolTip); - templ->SetAccessor(String::New("hAlign"), Get_FieldState_hAlign, Set_FieldState_hAlign); - templ->SetAccessor(String::New("vAlign"), Get_FieldState_vAlign, Set_FieldState_vAlign); - templ->SetAccessor(String::New("borders"), Get_FieldState_borders, Set_FieldState_borders); -} diff --git a/plugins/Skins/SkinLib/FieldState_v8_wrapper.h b/plugins/Skins/SkinLib/FieldState_v8_wrapper.h deleted file mode 100644 index 10c2a854b4..0000000000 --- a/plugins/Skins/SkinLib/FieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __FIELD_STATE_V8_WRAPPER_H__ -# define __FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddFieldStateAcessors(v8::Handle &templ); - - - -#endif // __FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/FontState.cpp b/plugins/Skins/SkinLib/FontState.cpp deleted file mode 100644 index da9b4153d5..0000000000 --- a/plugins/Skins/SkinLib/FontState.cpp +++ /dev/null @@ -1,186 +0,0 @@ -#include "globals.h" -#include "FontState.h" - - -FontState::FontState(HFONT hFont, COLORREF aColor) : hFont(NULL), externalFont(false), color(aColor) -{ - setHFONT(hFont); -} - -FontState::~FontState() -{ - releaseHFONT(); -} - -void FontState::rebuildHFONT() -{ - releaseHFONT(); - buildHFONT(); -} - -void FontState::buildAttribs() -{ - LOGFONT lf = {0}; - if (hFont == NULL || GetObject(hFont, sizeof(lf), &lf) == 0) - { - face = _T("Tahoma"); - size = 9; - italic = false; - bold = false; - underline = false; - strikeout = false; - - rebuildHFONT(); - - return; - } - - face = lf.lfFaceName; - italic = (lf.lfItalic != 0); - bold = (lf.lfWeight > FW_NORMAL); - underline = (lf.lfUnderline != 0); - strikeout = (lf.lfStrikeOut != 0); - - HDC hdc = GetDC(NULL); - size = -MulDiv(lf.lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); - ReleaseDC(NULL, hdc); -} - -void FontState::buildHFONT() -{ - if (hFont != NULL) - return; - - LOGFONT lf; - - _tcscpy(lf.lfFaceName, getFace()); - - lf.lfWidth = lf.lfEscapement = lf.lfOrientation = 0; - lf.lfWeight = isBold() ? FW_BOLD : FW_NORMAL; - lf.lfItalic = isItalic() ? 1 : 0; - lf.lfUnderline = isUnderline() ? 1 : 0; - lf.lfStrikeOut = isStrikeOut() ? 1 : 0; - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfOutPrecision = OUT_DEFAULT_PRECIS; - lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; - lf.lfQuality = DEFAULT_QUALITY; - lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - - HDC hdc = GetDC(NULL); - lf.lfHeight = -MulDiv(getSize(), GetDeviceCaps(hdc, LOGPIXELSY), 72); - ReleaseDC(NULL, hdc); - - hFont = CreateFontIndirect(&lf); - externalFont = false; -} - -void FontState::releaseHFONT() -{ - if (hFont == NULL) - return; - - if (!externalFont) - DeleteObject(hFont); - - hFont = NULL; -} - - -HFONT FontState::getHFONT() const -{ - return hFont; -} - - -HFONT FontState::createHFONT() const -{ - LOGFONT lf; - if (hFont == NULL || GetObject(hFont, sizeof(lf), &lf) == 0) - return NULL; - else - return CreateFontIndirect(&lf); -} - -void FontState::setHFONT(HFONT hFont) -{ - releaseHFONT(); - this->hFont = hFont; - externalFont = true; - buildAttribs(); -} - -const TCHAR * FontState::getFace() const -{ - return face.c_str(); -} - -void FontState::setFace(const TCHAR * face) -{ - this->face = face; - rebuildHFONT(); -} - -int FontState::getSize() const -{ - return size; -} - -void FontState::setSize(int size) -{ - this->size = size; - rebuildHFONT(); -} - -COLORREF FontState::getColor() const -{ - return color; -} - -void FontState::setColor(COLORREF color) -{ - this->color = color; -} - -bool FontState::isItalic() const -{ - return italic; -} - -void FontState::setItalic(bool italic) -{ - this->italic = italic; - rebuildHFONT(); -} - -bool FontState::isBold() const -{ - return bold; -} - -void FontState::setBold(bool bold) -{ - this->bold = bold; - rebuildHFONT(); -} - -bool FontState::isUnderline() const -{ - return underline; -} - -void FontState::setUnderline(bool underline) -{ - this->underline = underline; - rebuildHFONT(); -} - -bool FontState::isStrikeOut() const -{ - return strikeout; -} - -void FontState::setStrikeOut(bool strikeout) -{ - this->strikeout = strikeout; - rebuildHFONT(); -} diff --git a/plugins/Skins/SkinLib/FontState.h b/plugins/Skins/SkinLib/FontState.h deleted file mode 100644 index de32bcdfb3..0000000000 --- a/plugins/Skins/SkinLib/FontState.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __FONT_STATE_H__ -# define __FONT_STATE_H__ - -#include "Field.h" - - -class FontState -{ -public: - FontState(HFONT hFont, COLORREF aColor); - ~FontState(); - - HFONT getHFONT() const; - void setHFONT(HFONT hFont); - HFONT createHFONT() const; /// Return a copy of the internal HFONT. The caller must free it - - const TCHAR * getFace() const; - void setFace(const TCHAR * face); - - int getSize() const; - void setSize(int size); - - COLORREF getColor() const; - void setColor(COLORREF color); - - bool isItalic() const; - void setItalic(bool italic); - - bool isBold() const; - void setBold(bool bold); - - bool isUnderline() const; - void setUnderline(bool underline); - - bool isStrikeOut() const; - void setStrikeOut(bool strikeout); - -private: - COLORREF color; - HFONT hFont; - bool externalFont; - std::tstring face; - int size; - bool italic; - bool bold; - bool underline; - bool strikeout; - - void rebuildHFONT(); - void buildHFONT(); - void releaseHFONT(); - void buildAttribs(); -}; - - - -#endif // __FONT_STATE_H__ diff --git a/plugins/Skins/SkinLib/FontState_v8_wrapper.cpp b/plugins/Skins/SkinLib/FontState_v8_wrapper.cpp deleted file mode 100644 index 5226736b24..0000000000 --- a/plugins/Skins/SkinLib/FontState_v8_wrapper.cpp +++ /dev/null @@ -1,269 +0,0 @@ -#include "globals.h" -#include "FontState_v8_wrapper.h" -#include -#include "FontState.h" -#include - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_FontState_face(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( String::New((const V8_TCHAR *) tmp->getFace()) ); -} - -static void Set_FontState_face(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - tmp->setFace(Utf8ToTchar(*utf8_value)); - } -} - - -static Handle Get_FontState_size(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getSize()) ); -} - -static void Set_FontState_size(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setSize(value->Int32Value()); -} - - -static Handle Get_FontState_italic(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Boolean::New(tmp->isItalic()) ); -} - -static void Set_FontState_italic(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsBoolean()) - tmp->setItalic(value->BooleanValue()); -} - - -static Handle Get_FontState_bold(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Boolean::New(tmp->isBold()) ); -} - -static void Set_FontState_bold(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsBoolean()) - tmp->setBold(value->BooleanValue()); -} - - -static Handle Get_FontState_underline(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Boolean::New(tmp->isUnderline()) ); -} - -static void Set_FontState_underline(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsBoolean()) - tmp->setUnderline(value->BooleanValue()); -} - - -static Handle Get_FontState_strikeOut(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Boolean::New(tmp->isStrikeOut()) ); -} - -static void Set_FontState_strikeOut(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsBoolean()) - tmp->setStrikeOut(value->BooleanValue()); -} - - -static Handle Get_FontState_color(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getColor()) ); -} - -static void Set_FontState_color(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - FontState *tmp = (FontState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setColor(value->Int32Value()); -} - - -void AddFontStateAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("face"), Get_FontState_face, Set_FontState_face); - templ->SetAccessor(String::New("size"), Get_FontState_size, Set_FontState_size); - templ->SetAccessor(String::New("italic"), Get_FontState_italic, Set_FontState_italic); - templ->SetAccessor(String::New("bold"), Get_FontState_bold, Set_FontState_bold); - templ->SetAccessor(String::New("underline"), Get_FontState_underline, Set_FontState_underline); - templ->SetAccessor(String::New("strikeOut"), Get_FontState_strikeOut, Set_FontState_strikeOut); - templ->SetAccessor(String::New("color"), Get_FontState_color, Set_FontState_color); -} diff --git a/plugins/Skins/SkinLib/FontState_v8_wrapper.h b/plugins/Skins/SkinLib/FontState_v8_wrapper.h deleted file mode 100644 index 4b0483ffd9..0000000000 --- a/plugins/Skins/SkinLib/FontState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __FONT_STATE_V8_WRAPPER_H__ -# define __FONT_STATE_V8_WRAPPER_H__ - -#include - -void AddFontStateAcessors(v8::Handle &templ); - - - -#endif // __FONT_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/IconField.cpp b/plugins/Skins/SkinLib/IconField.cpp deleted file mode 100644 index 4cf1aaf532..0000000000 --- a/plugins/Skins/SkinLib/IconField.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "globals.h" -#include "IconField.h" -#include "IconFieldState.h" - - -IconField::IconField(Dialog *dlg, const char *name) - : Field(dlg, name), hIcon(NULL) -{ - -} - -IconField::~IconField() -{ -} - -FieldType IconField::getType() const -{ - return SIMPLE_ICON; -} - -HICON IconField::getIcon() const -{ - return hIcon; -} - -void IconField::setIcon(HICON hIcon) -{ - if (this->hIcon == hIcon) - return; - - this->hIcon = hIcon; - fireOnChange(); -} - -FieldState * IconField::createState(DialogState *dialogState) -{ - return new IconFieldState(dialogState, this); -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/IconField.h b/plugins/Skins/SkinLib/IconField.h deleted file mode 100644 index 984b36b984..0000000000 --- a/plugins/Skins/SkinLib/IconField.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ICON_FIELD_H__ -# define __ICON_FIELD_H__ - -#include "Field.h" - - -class IconField : public Field -{ -public: - IconField(Dialog *dlg, const char *name); - virtual ~IconField(); - - virtual FieldType getType() const; - - virtual HICON getIcon() const; - virtual void setIcon(HICON hIcon); - - virtual FieldState * createState(DialogState *dialogState); - -private: - HICON hIcon; - -}; - - - -#endif // __ICON_FIELD_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/IconFieldState.cpp b/plugins/Skins/SkinLib/IconFieldState.cpp deleted file mode 100644 index fad1d67084..0000000000 --- a/plugins/Skins/SkinLib/IconFieldState.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "globals.h" -#include "IconFieldState.h" - -#define ICON_SIZE 16 - - -IconFieldState::IconFieldState(DialogState *dialog, IconField *field) - : FieldState(dialog, field) -{ -} - -IconFieldState::~IconFieldState() -{ -} - -IconField * IconFieldState::getField() const -{ - return (IconField *) FieldState::getField(); -} - -Size IconFieldState::getPreferedSize() const -{ - if (getIcon() == NULL) - return Size(0, 0); - - return Size(ICON_SIZE, ICON_SIZE); -} - -HICON IconFieldState::getIcon() const -{ - return getField()->getIcon(); -} - -bool IconFieldState::isEmpty() const -{ - return getIcon() == NULL; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/IconFieldState.h b/plugins/Skins/SkinLib/IconFieldState.h deleted file mode 100644 index b69e3fe01f..0000000000 --- a/plugins/Skins/SkinLib/IconFieldState.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ICON_FIELD_STATE_H__ -# define __ICON_FIELD_STATE_H__ - -#include "IconField.h" -#include "FieldState.h" - - -class IconFieldState : public FieldState -{ -public: - virtual ~IconFieldState(); - - virtual IconField * getField() const; - - virtual Size getPreferedSize() const; - - virtual HICON getIcon() const; - - virtual bool isEmpty() const; - -private: - IconFieldState(DialogState *dialog, IconField *field); - - friend class IconField; -}; - - -#endif // __ICON_FIELD_STATE_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/IconFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/IconFieldState_v8_wrapper.cpp deleted file mode 100644 index a955653652..0000000000 --- a/plugins/Skins/SkinLib/IconFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "globals.h" -#include "IconFieldState_v8_wrapper.h" -#include -#include "IconFieldState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -void AddIconFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - -} diff --git a/plugins/Skins/SkinLib/IconFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/IconFieldState_v8_wrapper.h deleted file mode 100644 index 7b63f801bc..0000000000 --- a/plugins/Skins/SkinLib/IconFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __ICON_FIELD_STATE_V8_WRAPPER_H__ -# define __ICON_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddIconFieldStateAcessors(v8::Handle &templ); - - - -#endif // __ICON_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/ImageField.cpp b/plugins/Skins/SkinLib/ImageField.cpp deleted file mode 100644 index c65cf99a0f..0000000000 --- a/plugins/Skins/SkinLib/ImageField.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "globals.h" -#include "ImageField.h" -#include "ImageFieldState.h" - - -ImageField::ImageField(Dialog *dlg, const char *name) - : Field(dlg, name), hBmp(NULL) -{ - -} - -ImageField::~ImageField() -{ -} - -FieldType ImageField::getType() const -{ - return SIMPLE_IMAGE; -} - -HBITMAP ImageField::getImage() const -{ - return hBmp; -} - -void ImageField::setImage(HBITMAP hBmp) -{ - if (this->hBmp == hBmp) - return; - - this->hBmp = hBmp; - fireOnChange(); -} - -FieldState * ImageField::createState(DialogState *dialogState) -{ - return new ImageFieldState(dialogState, this); -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ImageField.h b/plugins/Skins/SkinLib/ImageField.h deleted file mode 100644 index e2f08665ca..0000000000 --- a/plugins/Skins/SkinLib/ImageField.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __IMAGE_FIELD_H__ -# define __IMAGE_FIELD_H__ - -#include "Field.h" - -class ImageField : public Field -{ -public: - ImageField(Dialog *dlg, const char *name); - virtual ~ImageField(); - - virtual FieldType getType() const; - - virtual HBITMAP getImage() const; - virtual void setImage(HBITMAP hBmp); - - virtual FieldState * createState(DialogState *dialogState); - -private: - HBITMAP hBmp; - -}; - - - -#endif // __IMAGE_FIELD_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ImageFieldState.cpp b/plugins/Skins/SkinLib/ImageFieldState.cpp deleted file mode 100644 index f74d77e0f3..0000000000 --- a/plugins/Skins/SkinLib/ImageFieldState.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "globals.h" -#include "ImageFieldState.h" - - -ImageFieldState::ImageFieldState(DialogState *dialog, ImageField *field) - : FieldState(dialog, field) -{ -} - -ImageFieldState::~ImageFieldState() -{ -} - -ImageField * ImageFieldState::getField() const -{ - return (ImageField *) FieldState::getField(); -} - -Size ImageFieldState::getPreferedSize() const -{ - HBITMAP hBmp = getImage(); - BITMAP bmp; - if (hBmp == NULL || GetObject(hBmp, sizeof(bmp), &bmp) == 0) - return Size(0, 0); - - return Size(bmp.bmWidth, bmp.bmHeight); -} - -HBITMAP ImageFieldState::getImage() const -{ - return getField()->getImage(); -} - -bool ImageFieldState::isEmpty() const -{ - return getImage() == NULL; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ImageFieldState.h b/plugins/Skins/SkinLib/ImageFieldState.h deleted file mode 100644 index 493c4db16d..0000000000 --- a/plugins/Skins/SkinLib/ImageFieldState.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __IMAGE_FIELD_STATE_H__ -# define __IMAGE_FIELD_STATE_H__ - -#include "ImageField.h" -#include "FieldState.h" - - -class ImageFieldState : public FieldState -{ -public: - virtual ~ImageFieldState(); - - virtual ImageField * getField() const; - - virtual Size getPreferedSize() const; - - virtual HBITMAP getImage() const; - - virtual bool isEmpty() const; - -private: - ImageFieldState(DialogState *dialog, ImageField *field); - - friend class ImageField; -}; - - -#endif // __IMAGE_FIELD_STATE_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.cpp deleted file mode 100644 index 1e4a9b6a54..0000000000 --- a/plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "globals.h" -#include "ImageFieldState_v8_wrapper.h" -#include -#include "ImageFieldState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -void AddImageFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - -} diff --git a/plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.h deleted file mode 100644 index ea5f343e03..0000000000 --- a/plugins/Skins/SkinLib/ImageFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __IMAGE_FIELD_STATE_V8_WRAPPER_H__ -# define __IMAGE_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddImageFieldStateAcessors(v8::Handle &templ); - - - -#endif // __IMAGE_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/LabelField.cpp b/plugins/Skins/SkinLib/LabelField.cpp deleted file mode 100644 index 154ae2fce5..0000000000 --- a/plugins/Skins/SkinLib/LabelField.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "globals.h" -#include "LabelField.h" -#include "LabelFieldState.h" - - -LabelField::LabelField(Dialog *dlg, const char *name, HWND hwnd) - : ControlField(dlg, name, hwnd) -{ -} - -LabelField::~LabelField() -{ -} - -FieldType LabelField::getType() const -{ - return CONTROL_LABEL; -} - -FieldState * LabelField::createState(DialogState *dialogState) -{ - return new LabelFieldState(dialogState, this); -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/LabelField.h b/plugins/Skins/SkinLib/LabelField.h deleted file mode 100644 index 8c4cb04a03..0000000000 --- a/plugins/Skins/SkinLib/LabelField.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __LABEL_FIELD_H__ -# define __LABEL_FIELD_H__ - -#include "ControlField.h" - - -class LabelField : public ControlField -{ -public: - LabelField(Dialog *dlg, const char *name, HWND hwnd); - virtual ~LabelField(); - - virtual FieldType getType() const; - - virtual FieldState * createState(DialogState *dialogState); -}; - - - -#endif // __LABEL_FIELD_H__ diff --git a/plugins/Skins/SkinLib/LabelFieldState.cpp b/plugins/Skins/SkinLib/LabelFieldState.cpp deleted file mode 100644 index 364611fbf7..0000000000 --- a/plugins/Skins/SkinLib/LabelFieldState.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "globals.h" -#include "LabelFieldState.h" - - -LabelFieldState::LabelFieldState(DialogState *dialog, LabelField *field) - : ControlFieldState(dialog, field) -{ -} - -LabelFieldState::~LabelFieldState() -{ -} - -Size LabelFieldState::getPreferedSize() const -{ - int style = GetWindowLong(getField()->getHWND(), GWL_STYLE); - - int format = DT_EXPANDTABS | DT_EDITCONTROL; - if ((style & SS_LEFTNOWORDWRAP) || (style & SS_SIMPLE)) - format |= DT_SINGLELINE; - if (style & SS_NOPREFIX) - format |= DT_NOPREFIX; - Size ret = getTextPreferedSize(format); - - int border = getField()->getBorderSize(); - ret.x += 2 * border; - ret.y += 2 * border; - - return ret; -} - -bool LabelFieldState::isEmpty() const -{ - return lstrlen(getText()) <= 0; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/LabelFieldState.h b/plugins/Skins/SkinLib/LabelFieldState.h deleted file mode 100644 index dbbb3b04d3..0000000000 --- a/plugins/Skins/SkinLib/LabelFieldState.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __LABEL_FIELD_STATE_H__ -# define __LABEL_FIELD_STATE_H__ - -#include "ControlFieldState.h" -#include "LabelField.h" - - -class LabelFieldState : public ControlFieldState -{ -public: - virtual ~LabelFieldState(); - - virtual Size getPreferedSize() const; - - virtual bool isEmpty() const; - -private: - LabelFieldState(DialogState *dialog, LabelField *field); - - friend class LabelField; -}; - - - -#endif // __LABEL_FIELD_STATE_H__ diff --git a/plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.cpp deleted file mode 100644 index 9105a7d878..0000000000 --- a/plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "globals.h" -#include "LabelFieldState_v8_wrapper.h" -#include -#include "LabelFieldState.h" - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -void AddLabelFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - -} diff --git a/plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.h deleted file mode 100644 index 7d40de5bc2..0000000000 --- a/plugins/Skins/SkinLib/LabelFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __LABEL_FIELD_STATE_V8_WRAPPER_H__ -# define __LABEL_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddLabelFieldStateAcessors(v8::Handle &templ); - - - -#endif // __LABEL_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/Position.cpp b/plugins/Skins/SkinLib/Position.cpp deleted file mode 100644 index 6c68881fce..0000000000 --- a/plugins/Skins/SkinLib/Position.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "Position.h" - -Position::Position() : x(0), y(0) -{ -} - -Position::Position(int aX, int aY) : x(aX), y(aY) -{ -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/Position.h b/plugins/Skins/SkinLib/Position.h deleted file mode 100644 index ed43a1ece3..0000000000 --- a/plugins/Skins/SkinLib/Position.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __POSITION_H__ -# define __POSITION_H__ - - -struct Position -{ - int x; - int y; - - Position(); - Position(int x, int y); -}; - - - -#endif // __POSITION_H__ diff --git a/plugins/Skins/SkinLib/Size.cpp b/plugins/Skins/SkinLib/Size.cpp deleted file mode 100644 index 9c2eef5d5d..0000000000 --- a/plugins/Skins/SkinLib/Size.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "globals.h" -#include "Size.h" - -Size::Size() : x(0), y(0) -{ -} - -Size::Size(int aX, int aY) : x(aX), y(aY) -{ - -} - -int Size::resizeTo(int newX, int newY) -{ - if (newX < 0 && newY < 0) - return -1; - - if (newY < 0) - { - if (x < 0 || y < 0) - return -2; - - y = (int) (y * (newX / (float) x)); - x = newX; - } - else if (newX < 0) - { - if (x < 0 || y < 0) - return -2; - - x = (int) (x * (newY / (float) y)); - y = newY; - } - else - { - x = newX; - y = newY; - } - return 0; -} - -int Size::fitInside(int maxSize) -{ - if (x < 0 || y < 0) - return -2; - if (x <= maxSize && y <= maxSize) - return 0; - - if (x >= y) - { - y = (int) (y * (maxSize / (float) x)); - x = maxSize; - } - else - { - x = (int) (x * (maxSize / (float) y)); - y = maxSize; - } - return 0; -} - -int Size::scaleTo(int size) -{ - if (x < 0 || y < 0) - return -2; - - if (x >= y) - { - y = (int) (y * (size / (float) x)); - x = size; - } - else - { - x = (int) (x * (size / (float) y)); - y = size; - } - - return 0; -} - -bool Size::operator==(const Size &other) const -{ - return x == other.x && y == other.y; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/Size.h b/plugins/Skins/SkinLib/Size.h deleted file mode 100644 index 8c0a297aee..0000000000 --- a/plugins/Skins/SkinLib/Size.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __SIZE_H__ -# define __SIZE_H__ - - -struct Size -{ - int x; - int y; - - Size(); - Size(int aX, int aY); - - /// @return 0 on success - int resizeTo(int x, int y); - - /// @return 0 on success - int fitInside(int maxSize); - - /// @return 0 on success - int scaleTo(int size); - - bool operator==(const Size &other) const; -}; - - - -#endif // __SIZE_H__ diff --git a/plugins/Skins/SkinLib/SkinOption.h b/plugins/Skins/SkinLib/SkinOption.h deleted file mode 100644 index 7812303327..0000000000 --- a/plugins/Skins/SkinLib/SkinOption.h +++ /dev/null @@ -1 +0,0 @@ -#include "SkinOptions.h" \ No newline at end of file diff --git a/plugins/Skins/SkinLib/SkinOption_v8_wrapper.cpp b/plugins/Skins/SkinLib/SkinOption_v8_wrapper.cpp deleted file mode 100644 index 11a401ad2e..0000000000 --- a/plugins/Skins/SkinLib/SkinOption_v8_wrapper.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "globals.h" -#include "SkinOption_v8_wrapper.h" -#include -#include "SkinOption.h" -#include - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_SkinOption_description(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( String::New((const V8_TCHAR *) tmp->getDescription()) ); -} - -static void Set_SkinOption_description(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - tmp->setDescription(Utf8ToTchar(*utf8_value)); - } -} - - -static Handle Get_SkinOption_min(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getMin()) ); -} - -static void Set_SkinOption_min(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setMin(value->Int32Value()); -} - - -static Handle Get_SkinOption_max(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( Int32::New(tmp->getMax()) ); -} - -static void Set_SkinOption_max(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsNumber()) - tmp->setMax(value->Int32Value()); -} - - -static Handle Get_SkinOption_type(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - switch(tmp->getType()) - { - case CHECKBOX: return scope.Close( String::New((const V8_TCHAR *) _T("CHECKBOX")) ); - case NUMBER: return scope.Close( String::New((const V8_TCHAR *) _T("NUMBER")) ); - case TEXT: return scope.Close( String::New((const V8_TCHAR *) _T("TEXT")) ); - } - return scope.Close( Undefined() ); -} - -static void Set_SkinOption_type(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - SkinOption *tmp = (SkinOption *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - Utf8ToTchar tval(*utf8_value); - if ( lstrcmpi(_T("CHECKBOX"), tval) == 0 ) - tmp->setType(CHECKBOX); - else if ( lstrcmpi(_T("NUMBER"), tval) == 0 ) - tmp->setType(NUMBER); - else if ( lstrcmpi(_T("TEXT"), tval) == 0 ) - tmp->setType(TEXT); - } -} - - -void AddSkinOptionAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("description"), Get_SkinOption_description, Set_SkinOption_description); - templ->SetAccessor(String::New("min"), Get_SkinOption_min, Set_SkinOption_min); - templ->SetAccessor(String::New("max"), Get_SkinOption_max, Set_SkinOption_max); - templ->SetAccessor(String::New("type"), Get_SkinOption_type, Set_SkinOption_type); -} diff --git a/plugins/Skins/SkinLib/SkinOption_v8_wrapper.h b/plugins/Skins/SkinLib/SkinOption_v8_wrapper.h deleted file mode 100644 index 6aa05c2122..0000000000 --- a/plugins/Skins/SkinLib/SkinOption_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __SKIN_OPTION_V8_WRAPPER_H__ -# define __SKIN_OPTION_V8_WRAPPER_H__ - -#include - -void AddSkinOptionAcessors(v8::Handle &templ); - - - -#endif // __SKIN_OPTION_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/SkinOptions.cpp b/plugins/Skins/SkinLib/SkinOptions.cpp deleted file mode 100644 index 51fb96cbdb..0000000000 --- a/plugins/Skins/SkinLib/SkinOptions.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include "globals.h" -#include "SkinOptions.h" -#include - - -SkinOption::SkinOption(const char *aName) - : name(aName), type(CHECKBOX), valueCheckbox(false), valueNumber(0), - onChangeCallback(NULL), onChangeCallbackParam(NULL), - minValue(MININT), maxValue(MAXINT) -{ - description = Utf8ToTchar(aName); -} - -SkinOption::~SkinOption() -{ -} - -const char * SkinOption::getName() const -{ - return name.c_str(); -} - -SkinOptionType SkinOption::getType() const -{ - return type; -} - -void SkinOption::setType(SkinOptionType type) -{ - if (this->type == type) - return; - - this->type = type; - fireOnChange(); -} - -const TCHAR * SkinOption::getDescription() const -{ - return description.c_str(); -} - -void SkinOption::setDescription(const TCHAR * description) -{ - if (this->description == description) - return; - - this->description = description; - fireOnChange(); -} - -int SkinOption::getMax() const -{ - return maxValue; -} - -void SkinOption::setMax(int max) -{ - this->maxValue = max; - setValueNumber(valueNumber); -} - -int SkinOption::getMin() const -{ - return minValue; -} - -void SkinOption::setMin(int min) -{ - this->minValue = min; - setValueNumber(valueNumber); -} - -bool SkinOption::getValueCheckbox() const -{ - return valueCheckbox; -} - -void SkinOption::setValueCheckbox(bool value) -{ - if (valueCheckbox == value) - return; - - valueCheckbox = value; - fireOnChange(); -} - -int SkinOption::getValueNumber() const -{ - return max(minValue, min(maxValue, valueNumber)); -} - -void SkinOption::setValueNumber(int value) -{ - value = max(minValue, min(maxValue, value)); - - if (value == valueNumber) - return; - - valueNumber = value; - fireOnChange(); -} - -const TCHAR * SkinOption::getValueText() const -{ - return valueText.c_str(); -} - -void SkinOption::setValueText(const TCHAR * value) -{ - if (valueText == value) - return; - - valueText = value; - fireOnChange(); -} - -void SkinOption::setOnChangeCallback(SkinOptionCallback cb, void *param /*= NULL*/) -{ - onChangeCallback = cb; - onChangeCallbackParam = param; -} - -void SkinOption::fireOnChange() -{ - if (onChangeCallback != NULL) - onChangeCallback(onChangeCallbackParam, this); -} - - - -SkinOptions::SkinOptions() - : onAddRemoveCallback(NULL), onAddRemoveCallbackParam(NULL), - onChangeCallback(NULL), onChangeCallbackParam(NULL) -{ -} - -SkinOptions::~SkinOptions() -{ - for(unsigned int i = 0; i < options.size(); i++) - delete options[i]; - options.clear(); -} - -bool SkinOptions::addOption(SkinOption *opt) -{ - _ASSERT(opt != NULL); - _ASSERT(opt->getName() != NULL); - - if (getOption(opt->getName()) != NULL) - return false; - - opt->setOnChangeCallback(onChangeCallback, onChangeCallbackParam); - options.push_back(opt); - - fireOnAddRemove(opt); - return true; -} - -SkinOption * SkinOptions::getOption(const char *name) const -{ - _ASSERT(name != NULL); - - for(unsigned int i = 0; i < options.size(); i++) - { - SkinOption *opt = options[i]; - if (strcmp(opt->getName(), name) == 0) - return opt; - } - return NULL; -} - -SkinOption * SkinOptions::getOption(unsigned int pos) const -{ - if (pos >= options.size()) - return NULL; - return options[pos]; -} - -unsigned int SkinOptions::getNumOptions() const -{ - return options.size(); -} - -void SkinOptions::clearOptions() -{ - if (options.size() <= 0) - return; - - for(unsigned int i = 0; i < options.size(); i++) - { - fireOnAddRemove(options[i]); - delete options[i]; - } - options.clear(); -} - -void SkinOptions::setOnOptionAddRemoveCallback(SkinOptionCallback cb, void *param /*= NULL*/) -{ - onAddRemoveCallback = cb; - onAddRemoveCallbackParam = param; -} - -void SkinOptions::setOnOptionChangeCallback(SkinOptionCallback cb, void *param /*= NULL*/) -{ - onChangeCallback = cb; - onChangeCallbackParam = param; - - for(unsigned int i = 0; i < options.size(); i++) - options[i]->setOnChangeCallback(cb, param); -} - -void SkinOptions::fireOnAddRemove(SkinOption *opt) -{ - if (onAddRemoveCallback != NULL) - onAddRemoveCallback(onAddRemoveCallbackParam, opt); -} diff --git a/plugins/Skins/SkinLib/SkinOptions.h b/plugins/Skins/SkinLib/SkinOptions.h deleted file mode 100644 index 41d238a5a1..0000000000 --- a/plugins/Skins/SkinLib/SkinOptions.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __SKINNED_DIALOG_OPTIONS_H__ -# define __SKINNED_DIALOG_OPTIONS_H__ - -#include -#include "tstring.h" -#include - - -enum SkinOptionType -{ - CHECKBOX, - NUMBER, - TEXT -}; - -class SkinOption; - -typedef void (*SkinOptionCallback)(void *param, const SkinOption *opt); - - -class SkinOption -{ -public: - SkinOption(const char *name); - ~SkinOption(); - - const char * getName() const; - - SkinOptionType getType() const; - void setType(SkinOptionType type); - - const TCHAR * getDescription() const; - void setDescription(const TCHAR * description); - - int getMax() const; - void setMax(int max); - - int getMin() const; - void setMin(int min); - - bool getValueCheckbox() const; - void setValueCheckbox(bool value); - - int getValueNumber() const; - void setValueNumber(int value); - - const TCHAR * getValueText() const; - void setValueText(const TCHAR * value); - - void setOnChangeCallback(SkinOptionCallback cb, void *param = NULL); - -private: - std::string name; - SkinOptionType type; - std::tstring description; - bool valueCheckbox; - int valueNumber; - int minValue; - int maxValue; - std::tstring valueText; - - SkinOptionCallback onChangeCallback; - void * onChangeCallbackParam; - - void fireOnChange(); -}; - - -class SkinOptions -{ -public: - SkinOptions(); - ~SkinOptions(); - - bool addOption(SkinOption *opt); - SkinOption * getOption(const char *name) const; - SkinOption * getOption(unsigned int pos) const; - unsigned int getNumOptions() const; - void clearOptions(); - - void setOnOptionAddRemoveCallback(SkinOptionCallback cb, void *param = NULL); - void setOnOptionChangeCallback(SkinOptionCallback cb, void *param = NULL); - -private: - std::vector options; - - SkinOptionCallback onAddRemoveCallback; - void * onAddRemoveCallbackParam; - - SkinOptionCallback onChangeCallback; - void * onChangeCallbackParam; - - void fireOnAddRemove(SkinOption *opt); -}; - - - -#endif // __SKINNED_DIALOG_OPTIONS_H__ diff --git a/plugins/Skins/SkinLib/SkinnedDialog.cpp b/plugins/Skins/SkinLib/SkinnedDialog.cpp deleted file mode 100644 index 917193ad94..0000000000 --- a/plugins/Skins/SkinLib/SkinnedDialog.cpp +++ /dev/null @@ -1,235 +0,0 @@ -#include "globals.h" -#include "SkinnedDialog.h" - -#include -#include "V8Script.h" -#include -#include "SkinOptions.h" - - -SkinnedDialog::SkinnedDialog(const char *name) - : Dialog(name), fileChangedTime(0), - script(NULL), state(NULL), opts(NULL), defaultState(NULL), - errorCallback(NULL), errorCallbackParam(NULL), - traceCallback(NULL), traceCallbackParam(NULL) -{ - V8Script::initializeEngine(); -} - -SkinnedDialog::~SkinnedDialog() -{ - releaseState(); - releaseCompiledScript(); -} - -const TCHAR * SkinnedDialog::getFilename() const -{ - return filename.c_str(); -} - -void SkinnedDialog::setFilename(const TCHAR *filename) -{ - if (this->filename == filename) - return; - - this->filename = filename; - releaseState(); - releaseCompiledScript(); -} - -bool SkinnedDialog::addField(Field *field) -{ - if (Dialog::addField(field)) - { - releaseCompiledScript(); - releaseState(); - field->setOnChangeCallback(SkinnedDialog::staticOnFieldChange, this); - return true; - } - else - return false; -} - -void SkinnedDialog::setSize(const Size &size) -{ - if (getSize() == size) - return; - - Dialog::setSize(size); - releaseState(); -} - -int SkinnedDialog::compile() -{ - if (!fileChanged()) - return 1; - - releaseCompiledScript(); - - struct _stat st = {0}; - if (_tstat(filename.c_str(), &st) != 0) - return 0; - - std::tstring text; - readFile(text); - if (text.size() <= 0) - return 0; - - script = new V8Script(); - script->setExceptionCallback(errorCallback, errorCallbackParam); - - if (!script->compile(text.c_str(), this)) - { - releaseCompiledScript(); - return 0; - } - - std::pair pair = script->configure(this); - opts = pair.first; - defaultState = pair.second; - if (opts == NULL) - { - releaseCompiledScript(); - return 0; - } - - fileChangedTime = st.st_mtime; - - return 2; -} - -DialogState * SkinnedDialog::getState() -{ - if (state != NULL && !fileChanged()) - return state; - - releaseState(); - - if (filename.size() <= 0) - return NULL; - - if (!compile()) - return NULL; - - state = Dialog::createState(); - if (!script->run(state, opts, getInfo())) - { - releaseState(); - return NULL; - } - - return state; -} - -void SkinnedDialog::releaseCompiledScript() -{ - delete script; - script = NULL; - fileChangedTime = 0; - - delete opts; - opts = NULL; - - delete defaultState; - defaultState = NULL; -} - -void SkinnedDialog::releaseState() -{ - delete state; - state = NULL; -} - -bool SkinnedDialog::fileChanged() -{ - if (filename.size() <= 0) - return false; - - struct _stat st = {0}; - if (_tstat(filename.c_str(), &st) != 0) - return false; - - return st.st_mtime > fileChangedTime; -} - -void SkinnedDialog::readFile(std::tstring &ret) -{ - FILE* file = _tfopen(filename.c_str(), _T("rb")); - if (file == NULL) - return; - - fseek(file, 0, SEEK_END); - int size = ftell(file); - rewind(file); - - char* chars = new char[size + 1]; - chars[size] = '\0'; - for (int i = 0; i < size;) - { - int read = fread(&chars[i], 1, size - i, file); - i += read; - } - fclose(file); - - ret = Utf8ToTchar(chars); - - delete[] chars; -} - -void SkinnedDialog::onFieldChange(const Field *field) -{ - releaseState(); -} - - -void SkinnedDialog::staticOnFieldChange(void *param, const Field *field) -{ - _ASSERT(param != NULL); - _ASSERT(field != NULL); - - SkinnedDialog *skdlg = (SkinnedDialog *) param; - skdlg->onFieldChange(field); -} - -void SkinnedDialog::setErrorCallback(MessageCallback cb, void *param /*= NULL*/) -{ - errorCallback = cb; - errorCallbackParam = param; -} - -void SkinnedDialog::setTraceCallback(MessageCallback cb, void *param /*= NULL*/) -{ - traceCallback = cb; - traceCallbackParam = param; -} - -void SkinnedDialog::trace(TCHAR *msg, ...) -{ - if (traceCallback == NULL) - return; - - TCHAR buff[1024]; - memset(buff, 0, sizeof(buff)); - - va_list args; - va_start(args, msg); - - _vsntprintf(buff, MAX_REGS(buff) - 1, msg, args); - buff[MAX_REGS(buff) - 1] = 0; - - va_end(args); - - traceCallback(traceCallbackParam, buff); -} - -SkinOptions * SkinnedDialog::getOpts() -{ - compile(); - return opts; -} - -DialogState * SkinnedDialog::getDefaultState() -{ - compile(); - return defaultState; -} \ No newline at end of file diff --git a/plugins/Skins/SkinLib/SkinnedDialog.h b/plugins/Skins/SkinLib/SkinnedDialog.h deleted file mode 100644 index 1387082f44..0000000000 --- a/plugins/Skins/SkinLib/SkinnedDialog.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef __SKINNED_DIALOG_H__ -# define __SKINNED_DIALOG_H__ - -#include -#include -#include "tstring.h" - -#include "Dialog.h" -#include "ButtonField.h" -#include "EditField.h" -#include "IconField.h" -#include "ImageField.h" -#include "LabelField.h" -#include "TextField.h" - -#include "DialogState.h" -#include "BorderState.h" -#include "ButtonFieldState.h" -#include "EditFieldState.h" -#include "FontState.h" -#include "IconFieldState.h" -#include "ImageFieldState.h" -#include "LabelFieldState.h" -#include "TextFieldState.h" - -#include "SkinOptions.h" - -class V8Script; - - -typedef void (*MessageCallback)(void *param, const TCHAR *err); - - - -class SkinnedDialog : public Dialog -{ -public: - SkinnedDialog(const char *name); - virtual ~SkinnedDialog(); - - virtual const TCHAR * getFilename() const; - virtual void setFilename(const TCHAR *filename); - - virtual bool addField(Field *field); - - virtual void setSize(const Size &size); - - /// Return the cached state. Do not free the result. - /// Each call to this method can potentially create the state, so don't cache it. - virtual DialogState * getState(); - - virtual void setErrorCallback(MessageCallback cb, void *param = NULL); - virtual void setTraceCallback(MessageCallback cb, void *param = NULL); - - virtual SkinOptions * getOpts(); - virtual DialogState * getDefaultState(); - -protected: - virtual bool fileChanged(); - virtual int compile(); /// @return 0 error, 1 no change, 2 compiled - - virtual void trace(TCHAR *msg, ...); - - virtual void onFieldChange(const Field *field); - -private: - std::tstring filename; - __time64_t fileChangedTime; - V8Script *script; - DialogState *state; - SkinOptions *opts; - DialogState *defaultState; - - MessageCallback errorCallback; - void *errorCallbackParam; - MessageCallback traceCallback; - void *traceCallbackParam; - - void releaseCompiledScript(); - void releaseState(); - void readFile(std::tstring &ret); - - static void staticOnFieldChange(void *param, const Field *field); -}; - - - - -#endif // __SKINNED_DIALOG_H__ diff --git a/plugins/Skins/SkinLib/TextField.cpp b/plugins/Skins/SkinLib/TextField.cpp deleted file mode 100644 index d3841b98fd..0000000000 --- a/plugins/Skins/SkinLib/TextField.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "globals.h" -#include "TextField.h" -#include "TextFieldState.h" - - -TextField::TextField(Dialog *dlg, const char *name) - : Field(dlg, name), hFont(NULL), fontColor(RGB(0,0,0)) -{ -} - - -TextField::~TextField() -{ -} - - -FieldType TextField::getType() const -{ - return SIMPLE_TEXT; -} - - -void TextField::setText(const TCHAR *text) -{ - if (this->text == text) - return; - - this->text = text; - fireOnChange(); -} - - -const TCHAR * TextField::getText() const -{ - return text.c_str(); -} - - -void TextField::setFont(HFONT hFont) -{ - if (this->hFont == hFont) - return; - - this->hFont = hFont; - fireOnChange(); -} - - -HFONT TextField::getFont() const -{ - if (hFont != NULL) - return hFont; - - // The default is the GUI font - return (HFONT) GetStockObject(DEFAULT_GUI_FONT); -} - - -COLORREF TextField::getFontColor() const -{ - return fontColor; -} - - -void TextField::setFontColor(COLORREF color) -{ - if (fontColor == color) - return; - - fontColor = color; - fireOnChange(); -} - - -FieldState * TextField::createState(DialogState *dialogState) -{ - return new TextFieldState(dialogState, this); -} diff --git a/plugins/Skins/SkinLib/TextField.h b/plugins/Skins/SkinLib/TextField.h deleted file mode 100644 index 8d2291f876..0000000000 --- a/plugins/Skins/SkinLib/TextField.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __TEXT_FIELD_H__ -# define __TEXT_FIELD_H__ - -#include "Field.h" - - -class TextField : public Field -{ -public: - TextField(Dialog *dlg, const char *name); - virtual ~TextField(); - - virtual FieldType getType() const; - - virtual const TCHAR * getText() const; - virtual void setText(const TCHAR *text); - - virtual HFONT getFont() const; - virtual void setFont(HFONT hFont); - - virtual COLORREF getFontColor() const; - virtual void setFontColor(COLORREF color); - - virtual FieldState * createState(DialogState *dialogState); - -private: - std::tstring text; - HFONT hFont; - COLORREF fontColor; - -}; - - - -#endif // __TEXT_FIELD_H__ diff --git a/plugins/Skins/SkinLib/TextFieldState.cpp b/plugins/Skins/SkinLib/TextFieldState.cpp deleted file mode 100644 index 8e295d01ee..0000000000 --- a/plugins/Skins/SkinLib/TextFieldState.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "globals.h" -#include "TextFieldState.h" - - -TextFieldState::TextFieldState(DialogState *dialog, TextField *field) - : FieldState(dialog, field), font(field->getFont(), field->getFontColor()), textSet(false) -{ -} - -TextFieldState::~TextFieldState() -{ -} - -TextField * TextFieldState::getField() const -{ - return (TextField *) FieldState::getField(); -} - - -Size TextFieldState::getPreferedSize() const -{ - HDC hdc = CreateCompatibleDC(NULL); - - HFONT newFont = getFont()->getHFONT(); - HFONT oldFont = (HFONT) SelectObject(hdc, newFont); - - RECT rc = {0}; - const TCHAR *text = getText(); - DrawText(hdc, text, -1, &rc, DT_CALCRECT | DT_NOPREFIX | DT_EXPANDTABS | DT_SINGLELINE); - - SelectObject(hdc, oldFont); - - DeleteDC(hdc); - - return Size(rc.right - rc.left, rc.bottom - rc.top); -} - -const TCHAR * TextFieldState::getText() const -{ - if (textSet) - return text.c_str(); - - return getField()->getText(); -} - -void TextFieldState::setText(const TCHAR *text) -{ - this->text = text; - textSet = true; -} - -FontState * TextFieldState::getFont() -{ - return &font; -} - -const FontState * TextFieldState::getFont() const -{ - return &font; -} - -bool TextFieldState::isEmpty() const -{ - return lstrlen(getText()) <= 0; -} diff --git a/plugins/Skins/SkinLib/TextFieldState.h b/plugins/Skins/SkinLib/TextFieldState.h deleted file mode 100644 index 9779cfa569..0000000000 --- a/plugins/Skins/SkinLib/TextFieldState.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __TEXT_FIELD_STATE_H__ -# define __TEXT_FIELD_STATE_H__ - -#include "TextField.h" -#include "FieldState.h" -#include "FontState.h" - - -class TextFieldState : public FieldState -{ -public: - virtual ~TextFieldState(); - - virtual TextField * getField() const; - - virtual Size getPreferedSize() const; - - virtual const TCHAR * getText() const; - virtual void setText(const TCHAR *text); - - virtual FontState * getFont(); - virtual const FontState * getFont() const; - - virtual bool isEmpty() const; - -private: - TextFieldState(DialogState *dialog, TextField *field); - - FontState font; - BOOL textSet; - std::tstring text; - - - friend class TextField; -}; - - -#endif // __TEXT_FIELD_STATE_H__ \ No newline at end of file diff --git a/plugins/Skins/SkinLib/TextFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/TextFieldState_v8_wrapper.cpp deleted file mode 100644 index cf11fdb01f..0000000000 --- a/plugins/Skins/SkinLib/TextFieldState_v8_wrapper.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "globals.h" -#include "TextFieldState_v8_wrapper.h" -#include -#include "TextFieldState.h" -#include - -using namespace v8; - - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -static Handle Get_TextFieldState_text(Local property, const AccessorInfo &info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return scope.Close( Undefined() ); - - TextFieldState *tmp = (TextFieldState *) wrap->Value(); - if (tmp == NULL) - return scope.Close( Undefined() ); - - return scope.Close( String::New((const V8_TCHAR *) tmp->getText()) ); -} - -static void Set_TextFieldState_text(Local property, Local value, const AccessorInfo& info) -{ - HandleScope scope; - - Local self = info.Holder(); - Local wrap = Local::Cast(self->GetInternalField(0)); - if (wrap.IsEmpty()) - return; - - TextFieldState *tmp = (TextFieldState *) wrap->Value(); - if (tmp == NULL) - return; - - if (!value.IsEmpty() && value->IsString()) - { - String::Utf8Value utf8_value(value); - tmp->setText(Utf8ToTchar(*utf8_value)); - } -} - - -void AddTextFieldStateAcessors(Handle &templ) -{ - HandleScope scope; - - templ->SetAccessor(String::New("text"), Get_TextFieldState_text, Set_TextFieldState_text); -} diff --git a/plugins/Skins/SkinLib/TextFieldState_v8_wrapper.h b/plugins/Skins/SkinLib/TextFieldState_v8_wrapper.h deleted file mode 100644 index c5d9e48a80..0000000000 --- a/plugins/Skins/SkinLib/TextFieldState_v8_wrapper.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __TEXT_FIELD_STATE_V8_WRAPPER_H__ -# define __TEXT_FIELD_STATE_V8_WRAPPER_H__ - -#include - -void AddTextFieldStateAcessors(v8::Handle &templ); - - - -#endif // __TEXT_FIELD_STATE_V8_WRAPPER_H__ diff --git a/plugins/Skins/SkinLib/V8Script.cpp b/plugins/Skins/SkinLib/V8Script.cpp deleted file mode 100644 index c7619187a5..0000000000 --- a/plugins/Skins/SkinLib/V8Script.cpp +++ /dev/null @@ -1,236 +0,0 @@ -#include "globals.h" -#include "V8Script.h" -#include "V8Wrappers.h" - -#include - -using namespace v8; - -#ifdef UNICODE -# define V8_TCHAR uint16_t -#else -# define V8_TCHAR char -#endif - - -V8Wrappers *wrappers = NULL; - - -void V8Script::initializeEngine() -{ - if (wrappers != NULL) - return; - - wrappers = new V8Wrappers(); -} - - -V8Script::V8Script() : exceptionCallback(NULL), exceptionCallbackParam(NULL) -{ -} - -V8Script::~V8Script() -{ - dispose(); -} - -bool V8Script::compile(const TCHAR *source, Dialog *dlg) -{ - dispose(); - - HandleScope handle_scope; - - context = Context::New(NULL, wrappers->getGlobalTemplate()); - - Context::Scope context_scope(context); - - context->Global()->Set(String::New("window"), wrappers->newDialogState(), ReadOnly); - context->Global()->Set(String::New("opts"), wrappers->newOptions(), ReadOnly); - context->Global()->Set(String::New("info"), wrappers->newDialogInfo(), ReadOnly); - for(unsigned int i = 0; i < dlg->getFieldCount(); i++) - { - Field *field = dlg->getField(i); - context->Global()->Set(String::New(field->getName()), wrappers->newState(field->getType()), ReadOnly); - } - - TryCatch try_catch; - Local