mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 02:05:50 +00:00
fix typos.
svn path=/trunk/; revision=20543
This commit is contained in:
parent
a5a347cb7b
commit
89db3ed74e
9 changed files with 467 additions and 483 deletions
|
@ -1,453 +1,453 @@
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// main.cpp
|
// main.cpp
|
||||||
//
|
//
|
||||||
// Implementation of the Package Manager GUI
|
// Implementation of the Package Manager GUI
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Maarten Bosma, 09.01.2004
|
// Maarten Bosma, 09.01.2004
|
||||||
// maarten.paul@bosma.de
|
// maarten.paul@bosma.de
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
// This is the struct where the toolbar is defined
|
// This is the struct where the toolbar is defined
|
||||||
const TBBUTTON Buttons [] =
|
const TBBUTTON Buttons [] =
|
||||||
{
|
{
|
||||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
||||||
|
|
||||||
{0, 1, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // No Action
|
{0, 1, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // No Action
|
||||||
{1, 2, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Install
|
{1, 2, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Install
|
||||||
{2, 3, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Install from source
|
{2, 3, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Install from source
|
||||||
{3, 4, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Update
|
{3, 4, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Update
|
||||||
{4, 5, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Unistall
|
{4, 5, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON}, // Unistall
|
||||||
|
|
||||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
||||||
{5, 6, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // DoIt (tm)
|
{5, 6, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // DoIt (tm)
|
||||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
||||||
|
|
||||||
{6, 7, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // Help
|
{6, 7, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // Help
|
||||||
{7, 8, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // Options
|
{7, 8, TBSTATE_ENABLED, TBSTYLE_BUTTON}, // Options
|
||||||
|
|
||||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Application's Entry Point
|
// Application's Entry Point
|
||||||
int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
|
int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
WNDCLASSEX wc = {0};
|
WNDCLASSEX wc = {0};
|
||||||
WCHAR errbuf[2000];
|
WCHAR errbuf[2000];
|
||||||
|
|
||||||
// Window creation
|
// Window creation
|
||||||
wc.cbSize = sizeof(WNDCLASSEX);
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
wc.lpszClassName = L"pgkmgr";
|
wc.lpszClassName = L"pgkmgr";
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||||
wc.hInstance = hinst;
|
wc.hInstance = hinst;
|
||||||
wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_MAIN));
|
wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_MAIN));
|
||||||
wc.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR);
|
wc.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR);
|
||||||
|
|
||||||
RegisterClassEx(&wc);
|
RegisterClassEx(&wc);
|
||||||
|
|
||||||
hwnd = CreateWindow(L"pgkmgr",
|
hwnd = CreateWindow(L"pgkmgr",
|
||||||
L"ReactOS - Package Manager v0.3",
|
L"ReactOS - Package Manager v0.3",
|
||||||
WS_OVERLAPPEDWINDOW,
|
WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
500, 600,
|
500, 600,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
hinst,
|
hinst,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
||||||
// Toolbar creation
|
// Toolbar creation
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
hTBar = CreateToolbarEx(hwnd, WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT, 0, 8, hinst, IDB_TOOLBAR,
|
hTBar = CreateToolbarEx(hwnd, WS_CHILD|WS_VISIBLE|TBSTYLE_FLAT, 0, 8, hinst, IDB_TOOLBAR,
|
||||||
Buttons, sizeof(Buttons)/sizeof(TBBUTTON), TBSIZE, TBSIZE, TBSIZE, TBSIZE, sizeof(TBBUTTON));
|
Buttons, sizeof(Buttons)/sizeof(TBBUTTON), TBSIZE, TBSIZE, TBSIZE, TBSIZE, sizeof(TBBUTTON));
|
||||||
|
|
||||||
// Show the windows
|
// Show the windows
|
||||||
ShowWindow(hwnd, SW_SHOW);
|
ShowWindow(hwnd, SW_SHOW);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
// Load the tree
|
// Load the tree
|
||||||
int error = PML_LoadTree(&tree, "tree_bare.xml", AddItem);
|
int error = PML_LoadTree(&tree, "tree_bare.xml", AddItem);
|
||||||
|
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
MessageBox(0,PML_TransError(error, errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
|
MessageBox(0,PML_TransError(error, errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the help
|
// Read the help
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
// Start getting messages
|
// Start getting messages
|
||||||
while(GetMessage(&msg,NULL,0,0))
|
while(GetMessage(&msg,NULL,0,0))
|
||||||
{
|
{
|
||||||
if(!TranslateAccelerator(hwnd, hHotKeys, &msg))
|
if(!TranslateAccelerator(hwnd, hHotKeys, &msg))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close our handle
|
// Close our handle
|
||||||
PML_CloseTree (tree);
|
PML_CloseTree (tree);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a item to our tree
|
// Add a item to our tree
|
||||||
int AddItem (int id, const char* name, int parent, int icon)
|
int AddItem (int id, const char* name, int parent, int icon)
|
||||||
{
|
{
|
||||||
TV_INSERTSTRUCT tvins;
|
TV_INSERTSTRUCT tvins;
|
||||||
|
|
||||||
tvins.item.lParam = (UINT)id;
|
tvins.item.lParam = (UINT)id;
|
||||||
tvins.item.mask = TVIF_TEXT|TVIF_PARAM;
|
tvins.item.mask = TVIF_TEXT|TVIF_PARAM;
|
||||||
tvins.item.pszText = (WCHAR*)name; //that is ok
|
tvins.item.pszText = (WCHAR*)name; //that is ok
|
||||||
tvins.item.cchTextMax = strlen(name);
|
tvins.item.cchTextMax = strlen(name);
|
||||||
tvins.hInsertAfter = TVI_LAST;
|
tvins.hInsertAfter = TVI_LAST;
|
||||||
|
|
||||||
if(icon)
|
if(icon)
|
||||||
{
|
{
|
||||||
tvins.item.iImage = icon;
|
tvins.item.iImage = icon;
|
||||||
tvins.item.iSelectedImage = icon;
|
tvins.item.iSelectedImage = icon;
|
||||||
tvins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
tvins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent==0)
|
if (parent==0)
|
||||||
tvins.hParent = TVI_ROOT;
|
tvins.hParent = TVI_ROOT;
|
||||||
else
|
else
|
||||||
tvins.hParent = nodes[parent];
|
tvins.hParent = nodes[parent];
|
||||||
|
|
||||||
nodes[id] = (HTREEITEM)SendMessage(hTree, TVM_INSERTITEMA, 0, (LPARAM)&tvins);
|
nodes[id] = (HTREEITEM)SendMessage(hTree, TVM_INSERTITEMA, 0, (LPARAM)&tvins);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the Help from file and display it
|
// Load the Help from file and display it
|
||||||
void Help (void)
|
void Help (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buffer [2000];
|
char buffer [2000];
|
||||||
FILE* file = fopen ("help.txt", "r");
|
FILE* file = fopen ("help.txt", "r");
|
||||||
|
|
||||||
if(!file)
|
if(!file)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(i=0; i<2000; i++)
|
for(i=0; i<2000; i++)
|
||||||
{
|
{
|
||||||
buffer[i] = getc(file);
|
buffer[i] = getc(file);
|
||||||
if(buffer[i]==EOF) break;
|
if(buffer[i]==EOF) break;
|
||||||
}
|
}
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
|
|
||||||
SetText(buffer);
|
SetText(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create our Controls
|
// Create our Controls
|
||||||
void InitControls (HWND hwnd)
|
void InitControls (HWND hwnd)
|
||||||
{
|
{
|
||||||
|
|
||||||
HINSTANCE hinst = GetModuleHandle(NULL);
|
HINSTANCE hinst = GetModuleHandle(NULL);
|
||||||
WCHAR errbuf[2000];
|
WCHAR errbuf[2000];
|
||||||
|
|
||||||
// Create the controls
|
// Create the controls
|
||||||
hTree = CreateWindowEx(0, WC_TREEVIEW, L"TreeView", WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS,
|
hTree = CreateWindowEx(0, WC_TREEVIEW, L"TreeView", WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS,
|
||||||
0, 0, 0, 0, hwnd, NULL, hinst, NULL);
|
0, 0, 0, 0, hwnd, NULL, hinst, NULL);
|
||||||
|
|
||||||
hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", PML_TransError(IDS_LOAD, errbuf, sizeof(errbuf)/sizeof(WCHAR)), WS_CHILD|WS_VISIBLE|ES_MULTILINE,
|
hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", PML_TransError(IDS_LOAD, errbuf, sizeof(errbuf)/sizeof(WCHAR)), WS_CHILD|WS_VISIBLE|ES_MULTILINE,
|
||||||
0, 0, 100, 100, hwnd, NULL, hinst, NULL);
|
0, 0, 100, 100, hwnd, NULL, hinst, NULL);
|
||||||
|
|
||||||
hPopup = LoadMenu(hinst, MAKEINTRESOURCE(IDR_POPUP));
|
hPopup = LoadMenu(hinst, MAKEINTRESOURCE(IDR_POPUP));
|
||||||
|
|
||||||
// Create Tree Icons
|
// Create Tree Icons
|
||||||
HIMAGELIST hIcon = ImageList_Create(16,16,ILC_COLOR32,1,1);
|
HIMAGELIST hIcon = ImageList_Create(16,16,ILC_COLOR32,1,1);
|
||||||
SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hIcon);
|
SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hIcon);
|
||||||
|
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(1)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(1)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(11)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(11)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(12)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(12)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(13)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(13)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(14)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(14)));
|
||||||
|
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(2)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(2)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(3)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(3)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(4)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(4)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(5)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(5)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(6)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(6)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(7)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(7)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(8)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(8)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(9)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(9)));
|
||||||
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(10)));
|
ImageList_AddIcon(hIcon, LoadIcon(hinst, MAKEINTRESOURCE(10)));
|
||||||
|
|
||||||
// Setup Hotkeys
|
// Setup Hotkeys
|
||||||
hHotKeys = LoadAccelerators (hinst, MAKEINTRESOURCE(IDR_HOTKEYS));
|
hHotKeys = LoadAccelerators (hinst, MAKEINTRESOURCE(IDR_HOTKEYS));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the Icons
|
// Set the Icons
|
||||||
int SetIcon (int id, int icon)
|
int SetIcon (int id, int icon)
|
||||||
{
|
{
|
||||||
TVITEMEX item;
|
TVITEMEX item;
|
||||||
|
|
||||||
item.hItem = nodes[id];
|
item.hItem = nodes[id];
|
||||||
item.iImage = icon;
|
item.iImage = icon;
|
||||||
item.iSelectedImage = icon;
|
item.iSelectedImage = icon;
|
||||||
item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||||
|
|
||||||
TreeView_SetItem(hTree, &item);
|
TreeView_SetItem(hTree, &item);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the Icons
|
// Set the Icons
|
||||||
int Ask (const WCHAR* message)
|
int Ask (const WCHAR* message)
|
||||||
{
|
{
|
||||||
int ans = MessageBox (0,message,0,MB_YESNO);
|
int ans = MessageBox (0,message,0,MB_YESNO);
|
||||||
|
|
||||||
if(ans == IDYES)
|
if(ans == IDYES)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// En- or Disable a Button inside of the toolbar and the Context Menu
|
// En- or Disable a Button inside of the toolbar and the Context Menu
|
||||||
int SetButton (DWORD id, BOOL state)
|
int SetButton (DWORD id, BOOL state)
|
||||||
{
|
{
|
||||||
// Change the Toorbar Button
|
// Change the Toorbar Button
|
||||||
TBBUTTONINFO ti;
|
TBBUTTONINFO ti;
|
||||||
|
|
||||||
ti.cbSize = sizeof (ti);
|
ti.cbSize = sizeof (ti);
|
||||||
ti.dwMask = TBIF_STATE;
|
ti.dwMask = TBIF_STATE;
|
||||||
|
|
||||||
if(state)
|
if(state)
|
||||||
ti.fsState = TBSTATE_ENABLED;
|
ti.fsState = TBSTATE_ENABLED;
|
||||||
else
|
else
|
||||||
ti.fsState = TBSTATE_INDETERMINATE;
|
ti.fsState = TBSTATE_INDETERMINATE;
|
||||||
|
|
||||||
SendMessage (hTBar, TB_SETBUTTONINFO, id, (LPARAM)&ti);
|
SendMessage (hTBar, TB_SETBUTTONINFO, id, (LPARAM)&ti);
|
||||||
|
|
||||||
// Change the Context Menu item
|
// Change the Context Menu item
|
||||||
MENUITEMINFO mi;
|
MENUITEMINFO mi;
|
||||||
|
|
||||||
mi.cbSize = sizeof (mi);
|
mi.cbSize = sizeof (mi);
|
||||||
mi.fMask = MIIM_STATE;
|
mi.fMask = MIIM_STATE;
|
||||||
|
|
||||||
if(state)
|
if(state)
|
||||||
mi.fState = MFS_ENABLED;
|
mi.fState = MFS_ENABLED;
|
||||||
|
|
||||||
else
|
else
|
||||||
mi.fState = MFS_GRAYED;
|
mi.fState = MFS_GRAYED;
|
||||||
|
|
||||||
SetMenuItemInfo(hPopup, id, FALSE, &mi);
|
SetMenuItemInfo(hPopup, id, FALSE, &mi);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the text of the text box
|
// Set the text of the text box
|
||||||
int SetText (const char* text)
|
int SetText (const char* text)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char buffer [2000];
|
char buffer [2000];
|
||||||
|
|
||||||
if(!text)
|
if(!text)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
// the windows does not need "\n"
|
// the windows does not need "\n"
|
||||||
// for new lines but "\r\n"
|
// for new lines but "\r\n"
|
||||||
for(i=0,j=0; text[i]; i++,j++)
|
for(i=0,j=0; text[i]; i++,j++)
|
||||||
{
|
{
|
||||||
buffer[j] = text[i];
|
buffer[j] = text[i];
|
||||||
if(buffer[j] == '\n')
|
if(buffer[j] == '\n')
|
||||||
{
|
{
|
||||||
buffer[j] = '\r';
|
buffer[j] = '\r';
|
||||||
buffer[++j] = '\n';
|
buffer[++j] = '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer[j] = 0;
|
buffer[j] = 0;
|
||||||
|
|
||||||
SetWindowTextA(hEdit, buffer);
|
SetWindowTextA(hEdit, buffer);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows Message Callback (this is where most things happen)
|
// Windows Message Callback (this is where most things happen)
|
||||||
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
// at the very beginning ...
|
// at the very beginning ...
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
InitControls(hwnd);
|
InitControls(hwnd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// calculate the size of the controls
|
// calculate the size of the controls
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
RECT rcl;
|
RECT rcl;
|
||||||
SendMessage(hTBar, TB_AUTOSIZE, 0L, 0L);
|
SendMessage(hTBar, TB_AUTOSIZE, 0L, 0L);
|
||||||
GetWindowRect(hTBar, &rcl);
|
GetWindowRect(hTBar, &rcl);
|
||||||
|
|
||||||
int win_top = rcl.bottom - rcl.top;
|
int win_top = rcl.bottom - rcl.top;
|
||||||
int win_hight = HIWORD(lParam) - win_top;
|
int win_hight = HIWORD(lParam) - win_top;
|
||||||
|
|
||||||
MoveWindow(hTree, 0, win_top, LOWORD(lParam), splitter_pos*win_hight/100, TRUE);
|
MoveWindow(hTree, 0, win_top, LOWORD(lParam), splitter_pos*win_hight/100, TRUE);
|
||||||
MoveWindow(hEdit, 0, (splitter_pos*win_hight/100)+win_top, LOWORD(lParam), win_hight, TRUE);
|
MoveWindow(hEdit, 0, (splitter_pos*win_hight/100)+win_top, LOWORD(lParam), win_hight, TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// for the treeview
|
// for the treeview
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
if(((LPNMHDR)lParam)->code == TVN_SELCHANGED)
|
if(((LPNMHDR)lParam)->code == TVN_SELCHANGED)
|
||||||
{
|
{
|
||||||
selected = ((LPNMTREEVIEW)lParam)->itemNew.lParam;
|
selected = ((LPNMTREEVIEW)lParam)->itemNew.lParam;
|
||||||
PML_LoadPackage (tree, selected, SetButton);
|
PML_LoadPackage (tree, selected, SetButton);
|
||||||
SetText(PML_GetDescription (tree, selected));
|
SetText(PML_GetDescription (tree, selected));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((int)(((LPNMHDR)lParam)->code) == NM_RCLICK) // <= aarrggg LISP
|
else if ((int)(((LPNMHDR)lParam)->code) == NM_RCLICK) // <= aarrggg LISP
|
||||||
{
|
{
|
||||||
// which item has been click on
|
// which item has been click on
|
||||||
HTREEITEM item = TreeView_GetDropHilight(hTree);
|
HTREEITEM item = TreeView_GetDropHilight(hTree);
|
||||||
|
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
// mark the one as seleacted
|
// mark the one as seleacted
|
||||||
SendMessage (hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)item);
|
SendMessage (hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)item);
|
||||||
TreeView_EnsureVisible (hTree, item);
|
TreeView_EnsureVisible (hTree, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the context menu
|
// create the context menu
|
||||||
if(selected != 0)
|
if(selected != 0)
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
GetCursorPos (&pt);
|
GetCursorPos (&pt);
|
||||||
TrackPopupMenu (GetSubMenu(hPopup, 0), 0, (UINT)pt.x, (UINT)pt.y, 0, hwnd, NULL);
|
TrackPopupMenu (GetSubMenu(hPopup, 0), 0, (UINT)pt.x, (UINT)pt.y, 0, hwnd, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// for the toolbar
|
// for the toolbar
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
// All Actions
|
// All Actions
|
||||||
if(LOWORD(wParam) <= 5 && LOWORD(wParam) >= 1)
|
if(LOWORD(wParam) <= 5 && LOWORD(wParam) >= 1)
|
||||||
{
|
{
|
||||||
if(selected)
|
if(selected)
|
||||||
if(PML_SetAction(tree, selected, LOWORD(wParam)-1, SetIcon, Ask) == ERR_OK)
|
if(PML_SetAction(tree, selected, LOWORD(wParam)-1, SetIcon, Ask) == ERR_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
MessageBeep(MB_ICONHAND);
|
MessageBeep(MB_ICONHAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DoIt
|
// DoIt
|
||||||
else if(LOWORD(wParam)==6)
|
else if(LOWORD(wParam)==6)
|
||||||
{
|
{
|
||||||
if(PML_DoIt(tree, SetStatus, Ask) == ERR_OK)
|
if(PML_DoIt(tree, SetStatus, Ask) == ERR_OK)
|
||||||
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DOIT), hwnd, StatusProc);
|
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DOIT), hwnd, StatusProc);
|
||||||
else
|
else
|
||||||
MessageBeep(MB_ICONHAND);
|
MessageBeep(MB_ICONHAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help
|
// Help
|
||||||
else if(LOWORD(wParam)==7)
|
else if(LOWORD(wParam)==7)
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
else if(LOWORD(wParam)==8)
|
else if(LOWORD(wParam)==8)
|
||||||
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS), hwnd, OptionsProc);
|
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS), hwnd, OptionsProc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// prozess hotkeys
|
// prozess hotkeys
|
||||||
case WM_HOTKEY:
|
case WM_HOTKEY:
|
||||||
{
|
{
|
||||||
if(PML_SetAction(tree, selected, wParam, SetIcon, Ask) != ERR_OK)
|
if(PML_SetAction(tree, selected, wParam, SetIcon, Ask) != ERR_OK)
|
||||||
MessageBeep(MB_ICONHAND);
|
MessageBeep(MB_ICONHAND);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// ... at the very end
|
// ... at the very end
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: This function is called from another thread
|
// Warning: This function is called from another thread
|
||||||
int SetStatus (int status1, int status2, WCHAR* text)
|
int SetStatus (int status1, int status2, WCHAR* text)
|
||||||
{
|
{
|
||||||
WCHAR errbuf[2000];
|
WCHAR errbuf[2000];
|
||||||
|
|
||||||
// Set the Rage to 1000
|
// Set the Rage to 1000
|
||||||
SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETRANGE32, 0, 1000);
|
SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETRANGE32, 0, 1000);
|
||||||
SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETRANGE32, 0, 1000);
|
SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETRANGE32, 0, 1000);
|
||||||
|
|
||||||
// The prozessbars and the text filds
|
// The prozessbars and the text filds
|
||||||
if(text)
|
if(text)
|
||||||
SetDlgItemText(hStatus, IDC_TSTATUS, text);
|
SetDlgItemText(hStatus, IDC_TSTATUS, text);
|
||||||
|
|
||||||
if(status1!=-1)
|
if(status1!=-1)
|
||||||
SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETPOS, status1, 0);
|
SendMessage(GetDlgItem(hStatus, IDC_STATUS1), PBM_SETPOS, status1, 0);
|
||||||
|
|
||||||
if(status2!=-1)
|
if(status2!=-1)
|
||||||
SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETPOS, status2, 0);
|
SendMessage(GetDlgItem(hStatus, IDC_STATUS2), PBM_SETPOS, status2, 0);
|
||||||
|
|
||||||
// If the Status is 1000 very thing is done
|
// If the Status is 1000 everything is done
|
||||||
if(status1==1000)
|
if(status1==1000)
|
||||||
{
|
{
|
||||||
EndDialog(hStatus, TRUE);
|
EndDialog(hStatus, TRUE);
|
||||||
MessageBox(0,PML_TransError(status2, errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
|
MessageBox(0,PML_TransError(status2, errbuf, sizeof(errbuf)/sizeof(WCHAR)),0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for the Status Dialog
|
// Callback for the Status Dialog
|
||||||
INT_PTR CALLBACK StatusProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK StatusProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
hStatus = hwnd;
|
hStatus = hwnd;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WM_COMMAND: // can only be the about button
|
case WM_COMMAND: // can only be the about button
|
||||||
case WM_CLOSE: // the close-window-[x]
|
case WM_CLOSE: // the close-window-[x]
|
||||||
{
|
{
|
||||||
PML_Abort();
|
PML_Abort();
|
||||||
EndDialog(hwnd, TRUE);
|
EndDialog(hwnd, TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for the Options Dialog
|
// Callback for the Options Dialog
|
||||||
INT_PTR CALLBACK OptionsProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK OptionsProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
EndDialog(hwnd, TRUE);
|
EndDialog(hwnd, TRUE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
||||||
ERR_OK "Fertig."
|
ERR_OK "Fertig."
|
||||||
ERR_PACK "Es konnten nicht alle Packages installiert werden.\n\nFür mehr Details schauen Sie bitte in ""logfile.html""."
|
ERR_PACK "Es konnten nicht alle Packages installiert werden.\n\nFür mehr Details schauen Sie bitte in ""logfile.html""."
|
||||||
ERR_GENERIC "Ein Fehler ist aufgetreten. \nnFür mehr Details schauen Sie bitte in ""logfile.html""."
|
ERR_GENERIC "Ein Fehler ist aufgetreten. \nnFür mehr Details schauen Sie bitte in ""logfile.html""."
|
||||||
ERR_DOWNL "Eine benötigte Datei konnte nicht runtergeladen werden!\nnFür mehr Details schauen Sie bitte in ""logfile.html""."
|
ERR_DOWNL "Eine benötigte Datei konnte nicht runtergeladen werden!\nFür mehr Details schauen Sie bitte in ""logfile.html""."
|
||||||
ERR_FILE "Bei der Scriptausfürhung trat ein Fehler auf.\nDatei konnte nicht geöffnet werden."
|
ERR_FILE "Bei der Scriptausfürhung trat ein Fehler auf.\nDatei konnte nicht geöffnet werden."
|
||||||
|
|
||||||
ERR_SYNATX "Bei der Scriptausfürhung trat ein Fehler auf.\nSynatx-Fehler."
|
ERR_SYNATX "Bei der Scriptausfürhung trat ein Fehler auf.\nSynatx-Fehler."
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
Sub Main
|
Sub Main
|
||||||
' ToDo: Choose from different mirrors
|
' ToDo: Choose from different mirrors
|
||||||
download "http://prdownloads.sourceforge.net/sevenzip/7z432.exe?use_mirror=ovh", "7z432.exe"
|
download "http://ovh.dl.sourceforge.net/sourceforge/sevenzip/7z432.exe", "7z432.exe"
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub After
|
Sub After
|
||||||
shell 7z432.exe
|
shell 7z432.exe
|
||||||
' ToDo: Delete 7z432.exe
|
' ToDo: Delete 7z432.exe
|
||||||
End Sub
|
End Sub
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!--
|
|
||||||
Not in use since reactos can download it itself now.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<package>
|
|
||||||
<name>Mozilla Control</name>
|
|
||||||
<version>1.6</version>
|
|
||||||
<description>Provides the Gekko Engine for ReactOS.</description>
|
|
||||||
<scripts inst="mozillacontrol.inst.rps"/>
|
|
||||||
</package>
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
' Not in use anymore because reactos can download it without Package Manager
|
|
||||||
Sub Main
|
|
||||||
download ("http://www.iol.ie/~locka/mozilla/MozillaControl16.exe", "mozillacontrol16.exe")
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub After
|
|
||||||
shell mozillacontrol16.exe
|
|
||||||
End Sub
|
|
|
@ -1,4 +1,4 @@
|
||||||
Sub Main
|
Sub Main
|
||||||
' ToDo: Download putty.exe to programm files
|
' ToDo: Download putty.exe in own dir
|
||||||
download ("http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe", "putty.exe")
|
download ("http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe", "C:\Program Files\putty.exe")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<!--
|
||||||
|
ToDo:
|
||||||
|
Implement Unzipping
|
||||||
|
-->
|
||||||
<package>
|
<package>
|
||||||
<name>Ritlab Tiny Webserver</name>
|
<name>Ritlab Tiny Webserver</name>
|
||||||
<version>1.93</version>
|
<version>1.93</version>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<tree>
|
<tree>
|
||||||
<node name="Internet and Network" icon="5">
|
<node name="Internet and Network" icon="5">
|
||||||
<node name="Firefox" file="firefox.xml"/>
|
<node name="Firefox" file="firefox.xml"/>
|
||||||
<!--<node name="Mozilla Control" file="mozcontrol.xml"/>-->
|
|
||||||
<node name="Putty" file="putty.xml"/>
|
<node name="Putty" file="putty.xml"/>
|
||||||
<node name="Tiny Webserver" file="tiny.xml"/>
|
<!--<node name="Tiny Webserver" file="tiny.xml"/>--> <!-- Needs Zip support -->
|
||||||
</node>
|
</node>
|
||||||
<node name="Office" icon="6">
|
<node name="Office" icon="6">
|
||||||
<node name="AbiWord" file="abiword.xml"/>
|
<node name="AbiWord" file="abiword.xml"/>
|
||||||
|
@ -25,4 +24,4 @@
|
||||||
</node>
|
</node>
|
||||||
<node name="Others" icon="12"/>
|
<node name="Others" icon="12"/>
|
||||||
<node name="Installed Programms" icon="13"/>
|
<node name="Installed Programms" icon="13"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
<!--<node name="OpenOffice 1" file="openoffice.xml"/>--> <!-- Needs Zip support -->
|
<!--<node name="OpenOffice 1" file="openoffice.xml"/>--> <!-- Needs Zip support -->
|
||||||
<node name="Putty" file="putty.xml"/>
|
<node name="Putty" file="putty.xml"/>
|
||||||
<node name="TuxPaint" file="tuxpaint.xml"/>
|
<node name="TuxPaint" file="tuxpaint.xml"/>
|
||||||
<node name="Tiny Webserver" file="tiny.xml"/>
|
<!--<node name="Tiny Webserver" file="tiny.xml"/>--> <!-- Needs Zip support -->
|
||||||
</tree>
|
</tree>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue