summaryrefslogtreecommitdiff
path: root/plugins/YAPP
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-05-19 11:51:08 +0000
committerRobert Pösel <robyer@seznam.cz>2013-05-19 11:51:08 +0000
commit02d3a913e0f9c77f814293b771790e13d0e0f3de (patch)
tree7874ecbac542d94f5487bfb17c998b10d6e64203 /plugins/YAPP
parent9521b9fe8c50ad111e79544f955eb4354310b41e (diff)
YAPP:
- Added icon to enable/disable popups into toptoolbar - Fixes for icons - added support for icolib, added main menu icons, used standardized icons + big icon for history window - Version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@4726 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAPP')
-rw-r--r--plugins/YAPP/res/PPh2.icobin1150 -> 0 bytes
-rw-r--r--plugins/YAPP/res/popup.icobin0 -> 1150 bytes
-rw-r--r--plugins/YAPP/res/popup_history.icobin0 -> 5430 bytes
-rw-r--r--plugins/YAPP/res/popup_no.icobin0 -> 1150 bytes
-rw-r--r--plugins/YAPP/res/yapp.rc12
-rw-r--r--plugins/YAPP/src/common.h5
-rw-r--r--plugins/YAPP/src/resource.h29
-rw-r--r--plugins/YAPP/src/services.cpp37
-rw-r--r--plugins/YAPP/src/version.h2
-rw-r--r--plugins/YAPP/src/yapp.cpp71
-rw-r--r--plugins/YAPP/src/yapp_history.h1
-rw-r--r--plugins/YAPP/src/yapp_history_dlg.cpp4
-rw-r--r--plugins/YAPP/yapp_10.vcxproj7
-rw-r--r--plugins/YAPP/yapp_10.vcxproj.filters17
14 files changed, 126 insertions, 59 deletions
diff --git a/plugins/YAPP/res/PPh2.ico b/plugins/YAPP/res/PPh2.ico
deleted file mode 100644
index af9dc91e39..0000000000
--- a/plugins/YAPP/res/PPh2.ico
+++ /dev/null
Binary files differ
diff --git a/plugins/YAPP/res/popup.ico b/plugins/YAPP/res/popup.ico
new file mode 100644
index 0000000000..5b3fe4e65b
--- /dev/null
+++ b/plugins/YAPP/res/popup.ico
Binary files differ
diff --git a/plugins/YAPP/res/popup_history.ico b/plugins/YAPP/res/popup_history.ico
new file mode 100644
index 0000000000..6c1905b295
--- /dev/null
+++ b/plugins/YAPP/res/popup_history.ico
Binary files differ
diff --git a/plugins/YAPP/res/popup_no.ico b/plugins/YAPP/res/popup_no.ico
new file mode 100644
index 0000000000..cac10ab068
--- /dev/null
+++ b/plugins/YAPP/res/popup_no.ico
Binary files differ
diff --git a/plugins/YAPP/res/yapp.rc b/plugins/YAPP/res/yapp.rc
index 1bbcc4526c..bd981f31ae 100644
--- a/plugins/YAPP/res/yapp.rc
+++ b/plugins/YAPP/res/yapp.rc
@@ -13,13 +13,11 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -141,7 +139,7 @@ END
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_OPT1, DIALOG
BEGIN
@@ -177,8 +175,10 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_POPUP_HISTORY ICON "PPh2.ico"
-#endif // English (U.S.) resources
+IDI_POPUP ICON "popup.ico"
+IDI_NOPOPUP ICON "popup_no.ico"
+IDI_HISTORY ICON "popup_history.ico"
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/YAPP/src/common.h b/plugins/YAPP/src/common.h
index e4973da944..ed6370c42b 100644
--- a/plugins/YAPP/src/common.h
+++ b/plugins/YAPP/src/common.h
@@ -44,11 +44,12 @@
#include <m_avatars.h>
#include <m_popup.h>
#include <m_icolib.h>
+#include <m_toptoolbar.h>
#include <win2k.h>
#include <m_notify.h>
#include <m_yapp.h>
-#include <m_ieview.h> //need this for special renderers
+#include <m_ieview.h> //need this for special renderers
#include "version.h"
#include "message_pump.h"
@@ -58,6 +59,7 @@
#include "services.h"
#include "resource.h"
#include "yapp_history.h"
+#include "icons.h"
#define MODULE "YAPP"
@@ -82,7 +84,6 @@ typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
(BOOL)SendMessage((hwndLV), LVM_SORTITEMSEX, (WPARAM)(LPARAM)(_lPrm), (LPARAM)(PFNLVCOMPARE)(_pfnCompare))
#endif
-
#define PDF_UNICODE 0x0001
#define PDF_ICOLIB 0x0002
diff --git a/plugins/YAPP/src/resource.h b/plugins/YAPP/src/resource.h
index 6ffa3d7e86..16ca2ca609 100644
--- a/plugins/YAPP/src/resource.h
+++ b/plugins/YAPP/src/resource.h
@@ -1,15 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by popups2.rc
+// Used by D:\Development\Miranda NG\plugins\YAPP\res\yapp.rc
//
#define IDD_OPT1 101
-#define IDD_DIALOG1 102
#define IDD_OPT_NOTIFY 103
#define IDD_LST_HISTORY 104
-#define IDI_ICON1 105
-#define IDI_POPUP_HISTORY 105
-#define IDI_ICON2 106
-#define IDD_CLASSES 107
+#define IDI_POPUP 105
+#define IDI_NOPOPUP 106
+#define IDI_HISTORY 107
+#define IDD_CLASSES 108
#define IDC_RAD_NOTIMEOUT 1001
#define IDC_RAD_TIMEOUT 1002
#define IDC_ED_TIMEOUT 1003
@@ -17,16 +16,11 @@
#define IDC_ED_WIDTH 1005
#define IDC_ED_MAXHEIGHT 1006
#define IDC_SPIN_WIDTH 1007
-#define IDC_SPIN3 1008
#define IDC_SPIN_MAXHEIGHT 1009
-#define IDC_RAD_BOTTOMRIGHT 1010
#define IDC_ED_INDENT 1011
-#define IDC_RAD_BOTTOMLEFT 1012
#define IDC_ED_SBWIDTH 1012
#define IDC_SPIN_INDENT 1013
-#define IDC_RAD_TOPRIGHT 1014
#define IDC_SPIN_SBWIDTH 1014
-#define IDC_RAD_TOPLEFT 1015
#define IDC_ED_PADDING 1015
#define IDC_ED_TRANS 1016
#define IDC_SPIN_TRANS 1017
@@ -35,37 +29,24 @@
#define IDC_BTN_PREVIEW 1020
#define IDC_CMB_ANIMATE 1021
#define IDC_CHK_TRANSBG 1022
-#define IDC_RAD_RIGHTICON 1023
-#define IDC_SPIN_INDENT2 1023
#define IDC_SPIN_PADDING 1023
#define IDC_CHK_GLOBALHOVER 1024
-#define IDC_RAD_LEFTICON 1025
#define IDC_CHK_ROUNDCORNERSAV 1025
-#define IDC_RAD_NOAV 1026
-#define IDC_RAD_RIGHTAV 1027
-#define IDC_RAD_NOAV3 1028
-#define IDC_RAD_LEFTAV 1029
-#define IDC_ED_MAXHEIGHT2 1030
#define IDC_ED_AVSIZE 1031
#define IDC_SPIN_AVSIZE 1032
#define IDC_LST_STATUS 1033
#define IDC_CMB_PLACEMENT 1034
#define IDC_CMB_ICON 1035
#define IDC_CMB_AV 1036
-#define IDC_CMB_AV2 1037
#define IDC_CMB_TIME 1038
-#define IDC_CUSTOM1 1039
#define IDC_COL_TEXT 1039
-#define IDC_BORDERCOLOUR 1040
#define IDC_COL_BG 1040
#define IDC_CLOSE 1041
-#define IDC_LIST3 1042
#define IDC_LST_HISTORY 1043
#define IDC_HISTORY_FILTER 1044
#define IDC_HISTORY_FILTER_CASESENSITIVE 1046
#define IDC_LST_CLASSES 1047
#define IDC_CHK_TIMEOUT 1048
-#define IDC_BUTTON1 1050
// Next default values for new objects
//
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index 0d6b116f3f..2fe5802224 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -1,6 +1,7 @@
#include "common.h"
-HGENMENU hMenuShowHistory, hMenuToggleOnOff;
+extern HANDLE hTTButton;
+extern HGENMENU hMenuRoot, hMenuItem, hMenuItemHistory;
void StripBBCodesInPlace(wchar_t *text)
{
@@ -187,10 +188,19 @@ static INT_PTR IsSecondLineShown(WPARAM wParam, LPARAM lParam)
void UpdateMenu()
{
+ bool isEnabled = db_get_b(0, MODULE, "Enabled", 1) == 1;
+
CLISTMENUITEM mi = { sizeof(mi) };
- mi.pszName = (char*)(db_get_b(0, MODULE, "Enabled", 1) == 1 ? LPGEN("Disable Popups") : LPGEN("Enable Popups"));
- mi.flags = CMIM_NAME;// | CMIM_ICON;
- Menu_ModifyItem(hMenuToggleOnOff, &mi);
+ mi.ptszName = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"));
+ mi.hIcon = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
+ mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
+ Menu_ModifyItem(hMenuItem, &mi);
+
+ mi.flags = CMIM_ICON;
+ Menu_ModifyItem(hMenuRoot, &mi);
+
+ if (hTTButton)
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, isEnabled ? TTBST_PUSHED : TTBST_RELEASED);
}
INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) {
@@ -405,25 +415,6 @@ void InitServices()
CreateServiceFunction(MS_POPUP_SHOWHISTORY, PopUp_ShowHistory);
CreateServiceFunction("PopUp/ToggleEnabled", TogglePopups);
-
- ////////////////////////////////////////////////////////////////////////////
- // Menus
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_ALL;
- mi.position = 500010000;
- mi.pszPopupName = LPGEN("PopUps");
-
- hiPopupHistory = LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP_HISTORY));
- mi.hIcon = hiPopupHistory;
- mi.pszService= MS_POPUP_SHOWHISTORY;
- mi.pszName = LPGEN("Popup History");
- hMenuShowHistory = Menu_AddMainMenuItem(&mi);
-
- mi.hIcon = NULL;
- mi.pszService = "PopUp/ToggleEnabled";
- mi.pszName = (char*)(db_get_b(0, MODULE, "Enabled", 1) ? LPGEN("Disable Popups") : LPGEN("Enable Popups"));
- hMenuToggleOnOff = Menu_AddMainMenuItem(&mi);
}
void DeinitServices()
diff --git a/plugins/YAPP/src/version.h b/plugins/YAPP/src/version.h
index 52c5791da7..9348b34513 100644
--- a/plugins/YAPP/src/version.h
+++ b/plugins/YAPP/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 5
#define __RELEASE_NUM 0
-#define __BUILD_NUM 10
+#define __BUILD_NUM 11
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp
index 88aef60da0..ba7c30123c 100644
--- a/plugins/YAPP/src/yapp.cpp
+++ b/plugins/YAPP/src/yapp.cpp
@@ -19,6 +19,12 @@ COLORREF colFirstLine = RGB(255, 0, 0), colSecondLine = 0, colTime = RGB(0, 0, 2
colSidebar = RGB(128, 128, 128), colTitleUnderline = GetSysColor(COLOR_3DSHADOW);
int hLangpack;
+// toptoolbar button
+HANDLE hTTButton;
+
+// menu items
+HGENMENU hMenuRoot, hMenuItem, hMenuItemHistory;
+
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -64,6 +70,39 @@ int ReloadFont(WPARAM wParam, LPARAM lParam)
return 0;
}
+int IconsChanged(WPARAM, LPARAM)
+{
+ CLISTMENUITEM mi = { sizeof(mi) };
+
+ mi.hIcon = IcoLib_GetIcon(db_get_b(0, MODULE, "Enabled", 1) ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
+ mi.flags = CMIM_ICON;
+ Menu_ModifyItem(hMenuItem, &mi);
+ Menu_ModifyItem(hMenuRoot, &mi);
+
+ mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0);
+ mi.flags = CMIM_ICON;
+ Menu_ModifyItem(hMenuItemHistory, &mi);
+
+ return 0;
+}
+
+int TTBLoaded(WPARAM, LPARAM)
+{
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.pszService = "PopUp/ToggleEnabled";
+ ttb.lParamUp = 1;
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
+ if (db_get_b(0, MODULE, "Enabled", 1))
+ ttb.dwFlags |= TTBBF_PUSHED;
+ ttb.name = LPGEN("Toggle Popups");
+ ttb.hIconHandleUp = Skin_GetIconHandle(ICO_TB_POPUP_OFF);
+ ttb.hIconHandleDn = Skin_GetIconHandle(ICO_TB_POPUP_ON);
+ ttb.pszTooltipUp = LPGEN("Enable Popups");
+ ttb.pszTooltipDn = LPGEN("Disable Popups");
+ hTTButton = TopToolbar_AddButton(&ttb);
+ return 0;
+}
+
static void InitFonts()
{
font_id_firstline.cbSize = sizeof(FontIDT);
@@ -138,6 +177,34 @@ static void InitFonts()
ReloadFont(0, 0);
}
+void InitMenuItems(void)
+{
+ bool isEnabled = db_get_b(0, MODULE, "Enabled", 1) == 1;
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR;
+ mi.hParentMenu = HGENMENU_ROOT;
+
+ // Build main menu
+ mi.position = 500010000;
+ mi.ptszName = LPGENT("Popups");
+ mi.hIcon = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
+ hMenuRoot = Menu_AddMainMenuItem(&mi);
+
+ // Add item to main menu
+ mi.hParentMenu = (HGENMENU)hMenuRoot;
+
+ mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0);
+ mi.pszService= MS_POPUP_SHOWHISTORY;
+ mi.ptszName = LPGENT("Popup History");
+ hMenuItemHistory = Menu_AddMainMenuItem(&mi);
+
+ mi.hIcon = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
+ mi.pszService = "PopUp/ToggleEnabled";
+ mi.ptszName = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"));
+ hMenuItem = Menu_AddMainMenuItem(&mi);
+}
+
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
MNotifyGetLink();
@@ -146,6 +213,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
lstPopupHistory.SetRenderer(RENDER_HISTORYPP);
HookEvent(ME_FONT_RELOAD, ReloadFont);
+ HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
LoadModuleDependentOptions();
@@ -170,7 +238,10 @@ extern "C" int __declspec(dllexport) Load(void)
InitOptions();
InitNotify();
InitFonts();
+ InitIcons();
+ InitMenuItems();
+ HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
diff --git a/plugins/YAPP/src/yapp_history.h b/plugins/YAPP/src/yapp_history.h
index 4927086b21..540777def0 100644
--- a/plugins/YAPP/src/yapp_history.h
+++ b/plugins/YAPP/src/yapp_history.h
@@ -86,7 +86,6 @@ lParam - 0
extern PopupHistoryList lstPopupHistory; //defined in main.cpp
extern HWND hHistoryWindow; //the history window
-extern HICON hiPopupHistory;
void RefreshPopupHistory(HWND hWnd, int renderer);
INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp
index 9de3e8eda5..d6e25c41e4 100644
--- a/plugins/YAPP/src/yapp_history_dlg.cpp
+++ b/plugins/YAPP/src/yapp_history_dlg.cpp
@@ -14,7 +14,6 @@
#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM
HWND hHistoryWindow = 0; //the history window
-HICON hiPopupHistory; //popup history icon
PopupHistoryList lstPopupHistory; //defined in main.cpp
const TCHAR *szHistoryColumns[] = {_T("Title"), _T("Message"), _T("Timestamp")}; //need to make sure that the string and size vectors have the same number of elements
@@ -583,7 +582,8 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
{
int renderer = lstPopupHistory.GetRenderer();
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiPopupHistory);
+ SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0));
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,1));
LoadRenderer(hWnd, renderer);
diff --git a/plugins/YAPP/yapp_10.vcxproj b/plugins/YAPP/yapp_10.vcxproj
index 986f02ef59..37257086d6 100644
--- a/plugins/YAPP/yapp_10.vcxproj
+++ b/plugins/YAPP/yapp_10.vcxproj
@@ -180,6 +180,7 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="src\icons.cpp" />
<ClCompile Include="src\message_pump.cpp" />
<ClCompile Include="src\notify_imp.cpp" />
<ClCompile Include="src\options.cpp" />
@@ -194,6 +195,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\common.h" />
+ <ClInclude Include="src\icons.h" />
<ClInclude Include="src\message_pump.h" />
<ClInclude Include="src\notify.h" />
<ClInclude Include="src\options.h" />
@@ -207,6 +209,11 @@
<ResourceCompile Include="res\yapp.rc" />
<ResourceCompile Include="res\version.rc" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\popup.ico" />
+ <None Include="res\popup_history.ico" />
+ <None Include="res\popup_no.ico" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/plugins/YAPP/yapp_10.vcxproj.filters b/plugins/YAPP/yapp_10.vcxproj.filters
index 872e1a2ec4..1a7a2ec682 100644
--- a/plugins/YAPP/yapp_10.vcxproj.filters
+++ b/plugins/YAPP/yapp_10.vcxproj.filters
@@ -42,6 +42,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\icons.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\common.h">
@@ -71,6 +74,9 @@
<ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\icons.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\yapp.rc">
@@ -80,4 +86,15 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
+ <ItemGroup>
+ <None Include="res\popup.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\popup_no.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="res\popup_history.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ </ItemGroup>
</Project> \ No newline at end of file