Make use of new findskinfile

master
boisso 8 years ago
parent 9ded1a777d
commit aaca990d0d
  1. 60
      k-meleon/ie_favorites/ie_plugin.cpp
  2. 14
      k-meleon/ns_bookmarks/ns_bookmarks.cpp
  3. 2
      k-meleon/ns_bookmarks/ns_bookmarks_edit.cpp
  4. 1
      k-meleon/ns_bookmarks/ns_bookmarks_functions.h
  5. 4
      k-meleon/ns_bookmarks/ns_bookmarks_utils.cpp
  6. 8
      k-meleon/op_hotlist/op_edit.cpp
  7. 1
      k-meleon/op_hotlist/op_hotlist.h
  8. 58
      k-meleon/op_hotlist/op_plugin.cpp

@ -66,6 +66,33 @@ kmeleonPlugin kPlugin = {
DoMessage
};
void Setup()
{
HBITMAP bitmap;
int ilc_bits = ILC_COLOR;
wchar_t szFullPath[MAX_PATH];
kPlugin.kFuncs->FindSkinFile(L"favorites.bmp", szFullPath, MAX_PATH);
FILE *fp = _tfopen(szFullPath, _T("r"));
if (fp) {
fclose(fp);
bitmap = (HBITMAP)LoadImage(NULL, szFullPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
} else {
bitmap = LoadBitmap(kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_IMAGES));
ilc_bits = ILC_COLOR24;
}
BITMAP bmp;
GetObject(bitmap, sizeof(BITMAP), &bmp);
ilc_bits = (bmp.bmBitsPixel == 32 ? ILC_COLOR32 : (bmp.bmBitsPixel == 24 ? ILC_COLOR24 : (bmp.bmBitsPixel == 16 ? ILC_COLOR16 : (bmp.bmBitsPixel == 8 ? ILC_COLOR8 : (bmp.bmBitsPixel == 4 ? ILC_COLOR4 : ILC_COLOR)))));
gImagelist = ImageList_Create(bmp.bmWidth/6, bmp.bmHeight, ILC_MASK | ilc_bits, 4, 4);
if (gImagelist && bitmap)
ImageList_AddMasked(gImagelist, bitmap, RGB(255, 0, 255));
if (bitmap)
DeleteObject(bitmap);
}
long DoMessage(const char *to, const char *from, const char *subject, long data1, long data2)
{
if (to[0] == '*' || stricmp(to, kPlugin.dllname) == 0) {
@ -103,6 +130,9 @@ long DoMessage(const char *to, const char *from, const char *subject, long data1
if (gLoc) delete gLoc;
gLoc = Locale::kmInit(&kPlugin);
}
else if (stricmp(subject, "Setup") == 0) {
Setup();
}
else return 0;
return 1;
@ -110,10 +140,6 @@ long DoMessage(const char *to, const char *from, const char *subject, long data1
return 0;
}
#include "../findskin.cpp"
int Load(){
gLoc = Locale::kmInit(&kPlugin);
HDC hdcScreen = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
@ -169,30 +195,6 @@ int Load(){
bTitleSet = false;
}
HBITMAP bitmap;
int ilc_bits = ILC_COLOR;
TCHAR szFullPath[MAX_PATH];
FindSkinFile(szFullPath, _T("favorites.bmp"));
FILE *fp = _tfopen(szFullPath, _T("r"));
if (fp) {
fclose(fp);
bitmap = (HBITMAP)LoadImage(NULL, szFullPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
} else {
bitmap = LoadBitmap(kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_IMAGES));
ilc_bits = ILC_COLOR24;
}
BITMAP bmp;
GetObject(bitmap, sizeof(BITMAP), &bmp);
ilc_bits = (bmp.bmBitsPixel == 32 ? ILC_COLOR32 : (bmp.bmBitsPixel == 24 ? ILC_COLOR24 : (bmp.bmBitsPixel == 16 ? ILC_COLOR16 : (bmp.bmBitsPixel == 8 ? ILC_COLOR8 : (bmp.bmBitsPixel == 4 ? ILC_COLOR4 : ILC_COLOR)))));
gImagelist = ImageList_Create(bmp.bmWidth/6, bmp.bmHeight, ILC_MASK | ilc_bits, 4, 4);
if (gImagelist && bitmap)
ImageList_AddMasked(gImagelist, bitmap, RGB(255, 0, 255));
if (bitmap)
DeleteObject(bitmap);
ReadFavorites(gFavoritesPath, _T(""), gFavoritesRoot);
return true;
@ -523,7 +525,7 @@ void DoRebar(HWND rebarWnd){
// Register the band name and child hwnd
if (bTitleSet && szTitle[0] != 0) {
int len = _tcslen(szTitle);
char c = szTitle[len-1];
TCHAR c = szTitle[len-1];
if (c == ':')
szTitle[len-1] = 0;
kPlugin.kFuncs->RegisterBand(hWndTB, (char*)(const char*)CT_to_UTF8(szTitle), TRUE);

@ -93,6 +93,11 @@ kmeleonPlugin kPlugin = {
DoMessage
};
void Setup()
{
InitImageList(gImagelist);
}
long DoMessage(const char *to, const char *from, const char *subject, long data1, long data2)
{
if (to[0] == '*' || stricmp(to, kPlugin.dllname) == 0) {
@ -130,6 +135,9 @@ long DoMessage(const char *to, const char *from, const char *subject, long data1
if (gLoc) delete gLoc;
gLoc = Locale::kmInit(&kPlugin);
}
else if (stricmp(subject, "Setup") == 0) {
Setup();
}
else return 0;
return 1;
@ -137,10 +145,6 @@ long DoMessage(const char *to, const char *from, const char *subject, long data1
return 0;
}
#include "../findskin.cpp"
int Load(){
gLoc = Locale::kmInit(&kPlugin);
@ -218,8 +222,6 @@ int Load(){
kPlugin.kFuncs->GetPreference(PREF_INT, PREFERENCE_MAX_TB_SIZE, &gMaxTBSize, &gMaxTBSize);
if (gMaxTBSize < 1) gMaxTBSize = 20;
InitImageList(gImagelist);
strncpy(gBookmarksTitle, CT_to_UTF8(gLoc->GetString(IDS_DEFAULT_TITLE)), sizeof(gBookmarksTitle));
LoadBM(gBookmarkFile);

@ -589,7 +589,7 @@ int CALLBACK EditProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HICON hIcon;
TCHAR szFullPath[MAX_PATH];
FindSkinFile(szFullPath, _T("bookmarks-edit.ico"));
kPlugin.kFuncs->FindSkinFile(L"bookmarks-edit.ico", szFullPath, MAX_PATH);
if (*szFullPath==0 || (hIcon = (HICON)LoadImage( NULL, szFullPath, IMAGE_ICON, 0,0, LR_DEFAULTSIZE | LR_LOADFROMFILE ))==NULL)
hIcon = (HICON)LoadImage( kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_ICON), IMAGE_ICON, 0,0, LR_DEFAULTSIZE );

@ -48,7 +48,6 @@ void Rebuild();
int addLink(const char *url, const char *title, int flag, const char *iconurl = NULL);
void findNick(char *nick, char **url);
char *stristr(const char *String, const char *Pattern);
void FindSkinFile( TCHAR *szSkinFile, const TCHAR *filename );
#define MENU_TO_COMMAND(x) (x+SUBMENU_OFFSET)
#define COMMAND_TO_MENU(x) (HMENU)(x-SUBMENU_OFFSET)

@ -76,8 +76,8 @@ void InitImageList(HIMAGELIST& imageList)
int ilc_bits = ILC_COLOR;
COLORREF bgCol = RGB(255, 0, 255);
TCHAR szFullPath[MAX_PATH];
FindSkinFile(szFullPath, _T("bookmarks.bmp"));
wchar_t szFullPath[MAX_PATH];
kPlugin.kFuncs->FindSkinFile(L"bookmarks.bmp", szFullPath, MAX_PATH);
FILE *fp = _tfopen(szFullPath, _T("r"));
if (fp) {
fclose(fp);

@ -505,15 +505,15 @@ int CALLBACK EditProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
circling = 0;
HICON hIcon;
char szFullPath[MAX_PATH];
FindSkinFile(szFullPath, "hotlist-edit.ico");
wchar_t szFullPath[MAX_PATH];
kPlugin.kFuncs->FindSkinFile(L"hotlist-edit.ico", szFullPath, MAX_PATH);
if (*szFullPath==0 || (hIcon = (HICON)LoadImage( NULL, szFullPath, IMAGE_ICON, 0,0, LR_DEFAULTSIZE | LR_LOADFROMFILE ))==NULL)
if (*szFullPath==0 || (hIcon = (HICON)LoadImageW( NULL, szFullPath, IMAGE_ICON, 0,0, LR_DEFAULTSIZE | LR_LOADFROMFILE ))==NULL)
hIcon = (HICON)LoadImage( kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_ICON), IMAGE_ICON, 0,0, LR_DEFAULTSIZE );
if (hIcon)
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
if (*szFullPath==0 || (hIcon = (HICON)LoadImage( NULL, szFullPath, IMAGE_ICON, 16,16, LR_LOADFROMFILE ))==NULL)
if (*szFullPath==0 || (hIcon = (HICON)LoadImageW( NULL, szFullPath, IMAGE_ICON, 16,16, LR_LOADFROMFILE ))==NULL)
hIcon = (HICON)LoadImage( kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_ICON), IMAGE_ICON, 16,16, 0 );
if (hIcon)
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon);

@ -79,7 +79,6 @@ int addLink(char *url, char *title);
void findNick(char *nick, char **url);
LRESULT APIENTRY WndTBSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int CALLBACK EditProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
void FindSkinFile( char *szSkinFile, const char *filename );
UINT GetSiteIcon(char* url);
extern "C" {

@ -65,6 +65,34 @@ kmeleonPlugin kPlugin = {
DoMessage
};
void Setup()
{
if (!bIgnore) {
HBITMAP bitmap;
int ilc_bits = ILC_COLOR;
wchar_t szFullPath[MAX_PATH];
kPlugin.kFuncs->FindSkinFile(L"hotlist.bmp", szFullPath, MAX_PATH);
FILE *fp = _wfopen(szFullPath, L"r");
if (fp) {
fclose(fp);
bitmap = (HBITMAP)LoadImageW(NULL, szFullPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
} else {
bitmap = LoadBitmap(kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_IMAGES));
}
BITMAP bmp;
GetObject(bitmap, sizeof(BITMAP), &bmp);
ilc_bits = (bmp.bmBitsPixel == 32 ? ILC_COLOR32 : (bmp.bmBitsPixel == 24 ? ILC_COLOR24 : (bmp.bmBitsPixel == 16 ? ILC_COLOR16 : (bmp.bmBitsPixel == 8 ? ILC_COLOR8 : (bmp.bmBitsPixel == 4 ? ILC_COLOR4 : ILC_COLOR)))));
gImagelist = ImageList_Create(bmp.bmWidth/6, bmp.bmHeight, ILC_MASK | ilc_bits, 4, 4);
if (gImagelist && bitmap)
ImageList_AddMasked(gImagelist, bitmap, RGB(255, 0, 255));
if (bitmap)
DeleteObject(bitmap);
}
}
long DoMessage(const char *to, const char *from, const char *subject, long data1, long data2)
{
if (to[0] == '*' || stricmp(to, kPlugin.dllname) == 0) {
@ -103,6 +131,9 @@ long DoMessage(const char *to, const char *from, const char *subject, long data1
if (gLoc) delete gLoc;
gLoc = Locale::kmInit(&kPlugin);
}
else if (stricmp(subject, "Setup") == 0) {
Setup();
}
else return 0;
return 1;
@ -256,8 +287,6 @@ void getHotlistFile() {
kPlugin.kFuncs->SetPreference(PREF_STRING, PREFERENCE_HOTLIST_FILE, gHotlistFile, false);
}
#include "../findskin.cpp"
int Load(){
gLoc = Locale::kmInit(&kPlugin);
HDC hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
@ -298,31 +327,6 @@ int Load(){
getHotlistFile();
bEmpty = true;
if (!bIgnore) {
HBITMAP bitmap;
int ilc_bits = ILC_COLOR;
char szFullPath[MAX_PATH];
FindSkinFile(szFullPath, "hotlist.bmp");
FILE *fp = fopen(szFullPath, "r");
if (fp) {
fclose(fp);
bitmap = (HBITMAP)LoadImage(NULL, szFullPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
} else {
bitmap = LoadBitmap(kPlugin.hDllInstance, MAKEINTRESOURCE(IDB_IMAGES));
}
BITMAP bmp;
GetObject(bitmap, sizeof(BITMAP), &bmp);
ilc_bits = (bmp.bmBitsPixel == 32 ? ILC_COLOR32 : (bmp.bmBitsPixel == 24 ? ILC_COLOR24 : (bmp.bmBitsPixel == 16 ? ILC_COLOR16 : (bmp.bmBitsPixel == 8 ? ILC_COLOR8 : (bmp.bmBitsPixel == 4 ? ILC_COLOR4 : ILC_COLOR)))));
gImagelist = ImageList_Create(bmp.bmWidth/6, bmp.bmHeight, ILC_MASK | ilc_bits, 4, 4);
if (gImagelist && bitmap)
ImageList_AddMasked(gImagelist, bitmap, RGB(255, 0, 255));
if (bitmap)
DeleteObject(bitmap);
}
int ret = op_readFile(gHotlistFile);
lpszHotlistFile = strdup(gHotlistFile);
if (ret < 0) {

Loading…
Cancel
Save