Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/macos/README.TXT  view on Meta::CPAN

be found in INSTALL.



Usage:
------

Basically there are four ways to start MacZip:

a) Drag'n Drop
b) using the Dialog box (Menu: File -> Zip/Unzip):

Please read the file "ReadMe.1st"
for the description of the items a and b.

c) Using the Command line (Menu: File->Command Line):
   The Zip & UnZip tools are command line tools. So the
   behavior is exactly the same like the Zip & UnZip tools on
   Unix or Windows/DOS. This means, if you want to zip some
   files, you have to write a command line like this: "zip
   [switches] path_to_zip_archive path_to_files_folders"

   - Go to "File", select "Command Line" and the
     "MacZip Entry box" Dialog Box appears.

   An example:

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

/*****************************************************************************/

#define aboutAlert      128

#define selectDialog    129
#define okItem          1
#define cancelItem      2
#define editItem        3
#define staticItem      4

#define unzipMenuBar    128

#define appleMenu       128
#define aboutItem       1

#define fileMenu        129
#define extractItem     1
#define infoItem        2
#define listItem        3
#define testItem        4
#define commentItem     6
#define freshenItem     8
#define updateItem      9
#define quitItem        11

#define editMenu        130
#define cutItem         1
#define copyItem        2
#define pasteItem       3

#define modifierMenu    131
#define excludeItem     1
#define selectItem      2
#define quietItem       9
#define verboseItem     10

#define screenMenu      132
#define pauseItem       1
#define scrollItem      2

#define extractMenu     133
#define screenItem      3
#define junkItem        5

#define caseMenu        134
#define insensitiveItem 1
#define lowercaseItem   2

#define convertMenu     135
#define autoItem        1
#define binaryItem      2
#define textItem        3

#define overwriteMenu   136
#define alwaysItem      1
#define neverItem       2
#define promptItem      3

#define infoMenu        137
#define prtCommentItem  2
#define prtHeaderItem   3
#define prtTotalsItem   4

#define formatMenu      138
#define filenameItem    1
#define longItem        2
#define mediumItem      3
#define shortItem       4

#define allFlags        0x000FFFFF

#define quietFlag       0x00000001
#define verboseFlag     0x00000002

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN


/*****************************************************************************/
/*  Global Vars                                                              */
/*****************************************************************************/

char UnzipVersion[32], ZipinfoVersion[32];

long modifiers, modifierMask;

EventRecord myevent;
MenuHandle appleHandle, modifierHandle, screenHandle, extractHandle;
MenuHandle caseHandle, convertHandle, overwriteHandle, infoHandle;
MenuHandle formatHandle;
Handle menubar, itemHandle;
short itemType;
Rect itemRect;

char command;
extern char fileList[256];

Boolean stop;

SysEnvRec sysRec;

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

    short themenu, theitem;
    DialogPtr thedialog;
    Str255 name;
    long check;

    themenu = HiWord(menucommand);
    theitem = LoWord(menucommand);

    switch (themenu) {

    case appleMenu:
        if (theitem == aboutItem) {
            ParamText((StringPtr)UnzipVersion, (StringPtr)ZipinfoVersion, nil, nil);
            Alert(aboutAlert, nil);
        } else {
            GetMenuItemText(appleHandle, theitem, name);
            theitem = OpenDeskAcc(name);
        }
        break;

    case fileMenu:
        switch (theitem) {
        case extractItem:
            if (modifiers & screenFlag)
                command = 'c';
            else
                command = 'x';
            modifierMask = extractMask;
            break;
        case infoItem:
            command = 'Z';

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

            modifierMask = updateMask;
            break;
        case quitItem:
            stop = true;
            break;
        default:
            break;
        }
        break;

    case editMenu:
        break;

    case modifierMenu:
        switch (theitem) {
        case excludeItem:
            check = -1;
            break;
        case selectItem:
            thedialog = GetNewDialog(selectDialog, nil, (WindowPtr)(-1));
            SetPort(thedialog);
            do
                ModalDialog(nil, &theitem);
            while ((theitem != okItem) && (theitem != cancelItem));

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

            break;
        default:
            break;
        }
        if (check == 0)
            CheckItem(modifierHandle, theitem, false);
        else if (check > 0)
            CheckItem(modifierHandle, theitem, true);
        break;

    case screenMenu:
        switch (theitem) {
        case pauseItem:
            check = (modifiers ^= pauseFlag) & pauseFlag;
            screenControl("p", check);
            break;
        case scrollItem:
            check = (modifiers ^= scrollFlag) & scrollFlag;
            screenControl("s", check);
            break;
        default:
            break;
        }
        if (check == 0)
            CheckItem(screenHandle, theitem, false);
        else if (check > 0)
            CheckItem(screenHandle, theitem, true);
        break;

    case extractMenu:
        switch (theitem) {
        case screenItem:
            check = (modifiers ^= screenFlag) & screenFlag;
            break;
        case junkItem:
            check = (modifiers ^= junkFlag) & junkFlag;
            break;
        default:
            break;
        }
        if (check == 0)
            CheckItem(extractHandle, theitem, false);
        else if (check > 0)
            CheckItem(extractHandle, theitem, true);
        break;

    case caseMenu:
        switch (theitem) {
        case insensitiveItem:
            check = (modifiers ^= insensitiveFlag) & insensitiveFlag;
            break;
        case lowercaseItem:
            check = (modifiers ^= lowercaseFlag) & lowercaseFlag;
            break;
        default:
            break;
        }
        if (check == 0)
            CheckItem(caseHandle, theitem, false);
        else if (check > 0)
            CheckItem(caseHandle, theitem, true);
        break;

    case convertMenu:
        switch (theitem) {
        case autoItem:
            CheckItem(convertHandle, autoItem, true);
            CheckItem(convertHandle, binaryItem, false);
            CheckItem(convertHandle, textItem, false);
            modifiers &= (allFlags ^ textFlag);
            modifiers |= autoFlag;
            break;
        case binaryItem:
            CheckItem(convertHandle, autoItem, false);

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

            CheckItem(convertHandle, binaryItem, false);
            CheckItem(convertHandle, textItem, true);
            modifiers &= (allFlags ^ autoFlag);
            modifiers |= textFlag;
            break;
        default:
            break;
        }
        break;

    case overwriteMenu:
        switch (theitem) {
        case alwaysItem:
            CheckItem(overwriteHandle, alwaysItem, true);
            CheckItem(overwriteHandle, neverItem, false);
            CheckItem(overwriteHandle, promptItem, false);
            modifiers &= (allFlags ^ neverFlag);
            modifiers |= overwriteFlag;
            break;
        case neverItem:
            CheckItem(overwriteHandle, alwaysItem, false);

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

            CheckItem(overwriteHandle, alwaysItem, false);
            CheckItem(overwriteHandle, neverItem, false);
            CheckItem(overwriteHandle, promptItem, true);
            modifiers &= (allFlags ^ (neverFlag | overwriteFlag));
            break;
        default:
            break;
        }
        break;

    case infoMenu:
        switch (theitem) {
        case prtCommentItem:
            check = (modifiers ^= prtCommentFlag) & prtCommentFlag;
            break;
        case prtHeaderItem:
            check = (modifiers ^= prtHeaderFlag) & prtHeaderFlag;
            break;
        case prtTotalsItem:
            check = (modifiers ^= prtTotalsFlag) & prtTotalsFlag;
            break;
        default:
            break;
        }
        if (check == 0)
            CheckItem(infoHandle, theitem, false);
        else if (check > 0)
            CheckItem(infoHandle, theitem, true);
        break;

    case formatMenu:
        switch (theitem) {
        case filenameItem:
            CheckItem(formatHandle, filenameItem, true);
            CheckItem(formatHandle, longItem, false);
            CheckItem(formatHandle, mediumItem, false);
            CheckItem(formatHandle, shortItem, false);
            modifiers &= (allFlags ^ (longFlag | mediumFlag | shortFlag));
            modifiers |= filenameFlag;
            break;
        case longItem:

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

        default:
            break;
        }
        break;

    default:
        break;

    }

    HiliteMenu(0);
    return;
}



/*
** work with shortcuts
**
*/

static void dokey(myevent) EventRecord *myevent;
{
    char code;

    code = (char)(myevent->message & charCodeMask);

    if (myevent->modifiers & cmdKey) {
        if (myevent->what != autoKey) {
            domenu(MenuKey(code));
        }
    }

    return;
}



/*
** work with mouse-events

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

    long code;

    code = FindWindow(myevent->where, &whichwindow);

    switch (code) {

    case inSysWindow:
        SystemClick(myevent, whichwindow);
        break;

    case inMenuBar:
        domenu(MenuSelect(myevent->where));
        break;

    }

    return;
}



/*

unzip-6.0/macos/source/macunzip.c  view on Meta::CPAN

    Uz_Globs saveGlobals;
    Boolean haveEvent, useWNE;
    short markChar;
    char *ArchivePath, *ExtractPath;
    OSErr err;

    FlushEvents(everyEvent, 0);
    InitGraf(&qd.thePort);
    InitFonts();
    InitWindows();
    InitMenus();
    TEInit();
    InitDialogs(nil);
    InitCursor();

    CONSTRUCTGLOBALS();

    sprintf(UnzipVersion, "%d.%d%d%s of %s", UZ_MAJORVER, UZ_MINORVER,
        UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE);
    sprintf(ZipinfoVersion, "%d.%d%d%s of %s", ZI_MAJORVER, ZI_MINORVER,
        UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE);

    c2pstr(UnzipVersion);
    c2pstr(ZipinfoVersion);

    SysEnvirons(1, &sysRec);
    useWNE = TrapAvailable(sysRec.machineType, _WaitNextEvent, ToolTrap);

    SetMenuBar(menubar = GetNewMBar(unzipMenuBar));
    DisposeHandle(menubar);
    InsertMenu(GetMenu(screenMenu), -1);
    InsertMenu(GetMenu(extractMenu), -1);
    InsertMenu(GetMenu(caseMenu), -1);
    InsertMenu(GetMenu(convertMenu), -1);
    InsertMenu(GetMenu(overwriteMenu), -1);
    InsertMenu(GetMenu(infoMenu), -1);
    InsertMenu(GetMenu(formatMenu), -1);
    AppendResMenu(appleHandle = GetMenuHandle(appleMenu), 'DRVR');
    modifierHandle = GetMenuHandle(modifierMenu);
    screenHandle = GetMenuHandle(screenMenu);
    extractHandle = GetMenuHandle(extractMenu);
    caseHandle = GetMenuHandle(caseMenu);
    convertHandle = GetMenuHandle(convertMenu);
    overwriteHandle = GetMenuHandle(overwriteMenu);
    infoHandle = GetMenuHandle(infoMenu);
    formatHandle = GetMenuHandle(formatMenu);
    DrawMenuBar();

    screenOpen("Unzip");

    modifiers = 0;

    GetItemMark(modifierHandle, quietItem, &markChar);
    if (markChar) modifiers ^= quietFlag;
    GetItemMark(modifierHandle, verboseItem, &markChar);
    if (markChar) modifiers ^= verboseFlag;

unzip-6.0/wince/punzip.htp  view on Meta::CPAN

    <li>It's free!</li>
</ul>

<hr>
<h3>Installing Pocket UnZip</h3>

<p>Place <strong>PUNZIP.EXE</strong> and <strong>PUNZIP.HTP </strong>(optional
help file) into your <strong>\Windows</strong> directory on your
H/PC.</p>

<p>From your H/PC's <strong>Start Menu</strong>, choose <strong>Run...</strong>,
enter &quot;<strong>punzip</strong>&quot;, and tap <strong>OK</strong>.</p>

<p>The first time you run Pocket UnZip, it will register itself
as the application for handling Zip files. From then on, you can
just double-tap on Zip files in Explorer or from your Desktop to
open them in Pocket UnZip.</p>

<hr>
<h3>Opening a Zip File</h3>

unzip-6.0/wince/punzip.rc  view on Meta::CPAN

    "IDB_TOOLBAR BITMAP DISCARDABLE ""toolbar.bmp""\r\n"
    "IDB_IMAGELIST BITMAP DISCARDABLE ""imglist.bmp""\r\n"
    "#endif\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

IDR_UNZIP MENU DISCARDABLE
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "&Open...\tCtrl+O",            IDM_FILE_OPEN, GRAYED
        MENUITEM SEPARATOR
        MENUITEM "&Properties\tAlt+Enter",      IDM_FILE_PROPERTIES, GRAYED
        MENUITEM SEPARATOR

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

//              OnDeleteItem
//              OnItemChanged
//              Sort
//              CompareFunc
//              SetCaptionText
//              DrawBanner
//              AddDeleteColumns
//              ResizeColumns
//              GetZipErrorString
//              AddFileToListView
//              EnableAllMenuItems
//              CheckAllMenuItems
//              CenterWindow
//              AddTextToEdit
//              FormatValue
//              BuildAttributesString
//              BuildTypeString
//              GetFileFromPath
//              ForwardSlashesToBackSlashesA
//              ForwardSlashesToBackSlashesW
//              DeleteDirectory(LPTSTR szPath);
//              RegWriteKey
//              RegReadKey
//              WriteOptionString
//              WriteOptionInt
//              GetOptionString
//              GetOptionInt
//              DisableEditing
//              EditSubclassProc
//              GetMenuString
//              InitializeMRU
//              AddFileToMRU
//              RemoveFileFromMRU
//              ActivateMRU
//              ReadZipFileList
//              DlgProcProperties
//              MergeValues
//              CheckThreeStateBox
//              ExtractOrTestFiles
//              DlgProcExtractOrTest

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

void Sort(int sortColumn, BOOL fForce);
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM sortColumn);

// Helper/Utility Functions
void SetCaptionText(LPCTSTR szPrefix);
void DrawBanner(HDC hdc);
void AddDeleteColumns();
void ResizeColumns();
LPCTSTR GetZipErrorString(int error);
void AddFileToListView(FILE_NODE *pFile);
void EnableAllMenuItems(UINT uMenuItem, BOOL fEnabled);
void CheckAllMenuItems(UINT uMenuItem, BOOL fChecked);
void CenterWindow(HWND hWnd);
void AddTextToEdit(LPCSTR szText);
LPTSTR FormatValue(LPTSTR szValue, zusz_t uzValue);
LPTSTR BuildAttributesString(LPTSTR szBuffer, DWORD dwAttributes);
LPCSTR BuildTypeString(FILE_NODE *pFile, LPSTR szType);
LPCSTR GetFileFromPath(LPCSTR szPath);
void ForwardSlashesToBackSlashesA(LPSTR szBuffer);
#ifdef UNICODE
   void ForwardSlashesToBackSlashesW(LPWSTR szBuffer);
#  define ForwardSlashesToBackSlashes ForwardSlashesToBackSlashesW

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

      // Get and store command line file (if any).
      if (lpCmdLine && *lpCmdLine) {
         szZipPath = lpCmdLine;
      }

#else

      // On NT we add a cursor, icon, and menu to our application's window class.
      wc.hCursor      = LoadCursor(NULL, IDC_ARROW);
      wc.hIcon        = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_UNZIP));
      wc.lpszMenuName = MAKEINTRESOURCE(IDR_UNZIP);

      // On Windows NT, we use the standard overlapped window style.
      DWORD dwStyle = WS_OVERLAPPEDWINDOW;

      TCHAR szBuffer[_MAX_PATH];

      // Get and store command line file (if any).
      if (lpCmdLine && *lpCmdLine) {
         MBSTOTSTR(szBuffer, lpCmdLine, countof(szBuffer));
         szZipPath = szBuffer;

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN


   // Load our command line file if one was specified. Otherwise, just update
   // our banner to show that no file is loaded.
   if (szZipFile) {
      ReadZipFileList(szZipFile);
   } else {
      DrawBanner(NULL);
   }

   // Enable some controls.
   EnableAllMenuItems(IDM_FILE_OPEN,          TRUE);
   EnableAllMenuItems(IDM_FILE_CLOSE,         TRUE);
   EnableAllMenuItems(IDM_VIEW_EXPANDED_VIEW, TRUE);
   EnableAllMenuItems(IDM_HELP_ABOUT,         TRUE);

   // Set our temporary directory.
#ifdef _WIN32_WCE
   g_szTempDir = TEXT("\\Temporary Pocket UnZip Files");
#else
   g_szTempDir = TEXT("C:\\Temporary Pocket UnZip Files");

   // Set the drive to be the same drive as the OS installation is on.
   if (GetWindowsDirectory(g_szTempDirPath, countof(g_szTempDirPath))) {
      lstrcpy(g_szTempDirPath + 3, TEXT("Temporary Pocket UnZip Files"));

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

      { 5, IDM_ACTION_TEST_ALL,    0, TBSTYLE_BUTTON, 0, 0, 0, -1 },
      { 0, 0,                      0, TBSTYLE_SEP,    0, 0, 0, -1 },
      { 6, IDM_ACTION_VIEW,        0, TBSTYLE_BUTTON, 0, 0, 0, -1 },
      { 0, 0,                      0, TBSTYLE_SEP,    0, 0, 0, -1 },
      { 7, IDM_VIEW_EXPANDED_VIEW, 0, TBSTYLE_BUTTON, 0, 0, 0, -1 },
      { 8, IDM_VIEW_COMMENT,       0, TBSTYLE_BUTTON, 0, 0, 0, -1 }
   };

   // Our toolbar buttons' tool tip text.
   static LPTSTR szToolTips[] = {
       TEXT(""),  // Menu
       TEXT("Open (Ctrl+O)"),
       TEXT("Properties (Alt+Enter)"),
       TEXT("Extract Selected Files"),
       TEXT("Extract All Files"),
       TEXT("Test Selected Files"),
       TEXT("Test All Files"),
       TEXT("View Selected File"),
       TEXT("Expanded View"),
       TEXT("View Zip File Comment")
   };

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   g_hWndList = CreateWindow(WC_LISTVIEW, TEXT(""),
                             WS_VSCROLL | WS_CHILD | WS_VISIBLE |
                             LVS_REPORT | LVS_SHOWSELALWAYS,
                             0, 0, 0, 0, g_hWndMain, NULL, g_hInst, NULL);

#ifdef _WIN32_WCE

   // Create a command bar and add the toolbar bitmaps to it.
   g_hWndCmdBar = CommandBar_Create(g_hInst, g_hWndMain, 1);
   CommandBar_AddBitmap(g_hWndCmdBar, g_hInst, IDB_TOOLBAR, 9, 16, 16);
   CommandBar_InsertMenubar(g_hWndCmdBar, g_hInst, IDR_UNZIP, 0);
   CommandBar_AddButtons(g_hWndCmdBar, countof(tbButton), tbButton);
   CommandBar_AddAdornments(g_hWndCmdBar, fHelp ? CMDBAR_HELP : 0, 0);

   // Add tool tips to the tool bar.
   CommandBar_AddToolTips(g_hWndCmdBar, countof(szToolTips), szToolTips);

   // Store the height of the command bar for later calculations.
   g_cyCmdBar = CommandBar_Height(g_hWndCmdBar);

   // We set our wait window handle to our menu window within our command bar.
   // This is the last window that will be painted during startup of our app.
   g_hWndWaitFor = GetWindow(g_hWndCmdBar, GW_CHILD);

   // Add the help item to our help menu if we have a help file.
   if (fHelp) {
      HMENU hMenu = GetSubMenu(CommandBar_GetMenu(g_hWndCmdBar, 0), 3);
      InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
      InsertMenu(hMenu, 0, MF_BYPOSITION | MF_ENABLED, IDHELP, TEXT("&Help"));
   }

#else

   // Create a tool bar and add the toolbar bitmaps to it.
   g_hWndCmdBar = CreateToolbarEx(g_hWndMain, WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS,
                                  1, 9, g_hInst, IDB_TOOLBAR, tbButton,
                                  countof(tbButton), 16, 16, 16, 16,
                                  sizeof(TBBUTTON));

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   RECT rc;
   GetWindowRect(g_hWndCmdBar, &rc);
   g_cyCmdBar = rc.bottom - rc.top;

   // We set our wait window handle to our toolbar.
   // This is the last window that will be painted during the startup of our app.
   g_hWndWaitFor = g_hWndCmdBar;

   // Add the help item to our help menu if we have a help file.
   if (fHelp) {
      HMENU hMenu = GetSubMenu(GetMenu(g_hWndMain), 3);
      InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
      InsertMenu(hMenu, 0, MF_BYPOSITION | MF_ENABLED, IDHELP, TEXT("&Help\tF1"));
   }

#endif // _WIN32_WCE

   // Enable Full Row Select - This feature is supported on Windows CE and was
   // introduced to Win95/NT with IE 3.0.  If the user does not have a
   // COMCTL32.DLL that supports this feature, then they will just see the
   // old standard First Column Select.
   SendMessage(g_hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT |
               SendMessage(g_hWndList, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0));

   // Get our expanded view option from the registry.
   g_fExpandedView = GetOptionInt(TEXT("ExpandedView"), FALSE);

   // Show or remove menu check for expanded view option.
   CheckAllMenuItems(IDM_VIEW_EXPANDED_VIEW, g_fExpandedView);

   // Create our columns.
   AddDeleteColumns();

   // Set our current sort column to our name column
   Sort(0, TRUE);

   return 0;
}

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   }
}

//******************************************************************************
void OnViewExpandedView() {

   // Toggle our expanded view option.
   g_fExpandedView = !g_fExpandedView;

   // Show or remove menu check and toolbar button press.
   CheckAllMenuItems(IDM_VIEW_EXPANDED_VIEW, g_fExpandedView);

   // Display the new columns.
   AddDeleteColumns();

   // Re-sort if we just did away with out sort column.
   if (!g_fExpandedView && (g_sortColumn > 3)) {
      Sort(0, TRUE);
   }

   // Write our expanded view option to the registry.

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

      }

      // Free the item itself.
      delete[] (LPBYTE)pnmlv->lParam;
   }
}

//******************************************************************************
void OnItemChanged(NM_LISTVIEW *pnmlv) {
   int count = ListView_GetSelectedCount(pnmlv->hdr.hwndFrom);
   EnableAllMenuItems(IDM_FILE_PROPERTIES, count > 0);
   EnableAllMenuItems(IDM_ACTION_EXTRACT,  count > 0);
   EnableAllMenuItems(IDM_ACTION_TEST,     count > 0);
   EnableAllMenuItems(IDM_ACTION_VIEW,     count == 1);
}

//******************************************************************************
//***** List View Sort Functions
//******************************************************************************

void Sort(int sortColumn, BOOL fForce) {

   // Do not change the column header text if it is already correct.
   if (sortColumn != g_sortColumn) {

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

            }
         }
      }
   }

   // Add the item to our list.
   ListView_InsertItem(g_hWndList, &lvi);
}

//******************************************************************************
void EnableAllMenuItems(UINT uMenuItem, BOOL fEnabled) {
#ifdef _WIN32_WCE
   HMENU hMenu = CommandBar_GetMenu(g_hWndCmdBar, 0);
#else
   HMENU hMenu = GetMenu(g_hWndMain);
#endif
   EnableMenuItem(hMenu, uMenuItem, fEnabled ? MF_ENABLED : MF_GRAYED);
   SendMessage(g_hWndCmdBar, TB_ENABLEBUTTON, uMenuItem, MAKELONG(fEnabled, 0));
}

//******************************************************************************
void CheckAllMenuItems(UINT uMenuItem, BOOL fChecked) {
#ifdef _WIN32_WCE
   HMENU hMenu = CommandBar_GetMenu(g_hWndCmdBar, 0);
#else
   HMENU hMenu = GetMenu(g_hWndMain);
#endif
   CheckMenuItem(hMenu, uMenuItem, fChecked ? MF_CHECKED : MF_UNCHECKED);
   SendMessage(g_hWndCmdBar, TB_PRESSBUTTON, uMenuItem, MAKELONG(fChecked, 0));
}

//******************************************************************************
void CenterWindow(HWND hWnd) {

   RECT rc, rcParent;

   // Get our window rectangle.
   GetWindowRect(hWnd, &rc);

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   }
   return CallWindowProc(g_wpEdit, hWnd, uMsg, wParam, lParam);
}


//******************************************************************************
//***** MRU Functions
//******************************************************************************

#ifdef _WIN32_WCE
int GetMenuString(HMENU hMenu, UINT uIDItem, LPTSTR lpString, int nMaxCount,
                  UINT uFlag) {
   MENUITEMINFO mii;
   ZeroMemory(&mii, sizeof(mii));
   mii.cbSize = sizeof(mii);
   mii.fMask = MIIM_TYPE;
   mii.dwTypeData = lpString;
   mii.cch = nMaxCount;
   return (GetMenuItemInfo(hMenu, uIDItem, uFlag == MF_BYPOSITION, &mii) ?
           mii.cch : 0);
}
#endif

//******************************************************************************
void InitializeMRU() {

   TCHAR szMRU[MRU_MAX_FILE][_MAX_PATH + 4], szOption[8];
   int   i, j;

   // Get our menu handle.
#ifdef _WIN32_WCE
   HMENU hMenu = GetSubMenu(CommandBar_GetMenu(g_hWndCmdBar, 0), 0);
#else
   HMENU hMenu = GetSubMenu(GetMenu(g_hWndMain), 0);
#endif

   // Read all our current MRUs from the registry.
   for (i = 0, j = 0; i < MRU_MAX_FILE; i++) {

      // Build option name for current MRU and read from registry.
      _stprintf(szOption, TEXT("MRU%d"), i+1);
      GetOptionString(szOption, TEXT(""), &szMRU[i][3], sizeof(TCHAR) * _MAX_PATH);

      // If this MRU exists, then add it.
      if (szMRU[i][3]) {

         // Build the accelerator prefix for this menu item.
         szMRU[i][0] = TEXT('&');
         szMRU[i][1] = TEXT('1') + j;
         szMRU[i][2] = TEXT(' ');

         // Add the item to our menu.
         InsertMenu(hMenu, 4 + j, MF_BYPOSITION | MF_STRING, MRU_START_ID + j,
                    szMRU[i]);

         // Increment our actual MRU count.
         j++;
      }
   }
}

//******************************************************************************
void AddFileToMRU(LPCSTR szFile) {

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

      }
   }

   //---------------------------------------------------------------------------
   // The next thing we need to do is read our local MRU from our File menu,
   // merge in our new file, and store the new list back to our File menu.
   //---------------------------------------------------------------------------

   // Get our menu handle.
#ifdef _WIN32_WCE
   HMENU hMenu = GetSubMenu(CommandBar_GetMenu(g_hWndCmdBar, 0), 0);
#else
   HMENU hMenu = GetSubMenu(GetMenu(g_hWndMain), 0);
#endif

   // Read all our current MRUs from our File Menu.
   for (i = 1; i <= MRU_MAX_FILE; i++) {

      // Query our file Menu for a MRU file.
      if (GetMenuString(hMenu, MRU_START_ID + i - 1, szMRU[i],
                        countof(szMRU[0]), MF_BYCOMMAND))
      {
         // Delete this item from the menu for now.
         DeleteMenu(hMenu, MRU_START_ID + i - 1, MF_BYCOMMAND);
      } else {
         szMRU[i][3] = TEXT('\0');
      }
   }

   // Write our new merged MRU list back to the File menu.
   for (i = 0, j = 0; (i <= MRU_MAX_FILE) && (j < MRU_MAX_FILE); i++) {

      // If this MRU exists and is different then our new file, then add it.
      if ((i == 0) || (szMRU[i][3] && _tcsicmp(&szMRU[0][3], &szMRU[i][3]))) {

         // Build the accelerator prefix for this menu item.
         szMRU[i][0] = TEXT('&');
         szMRU[i][1] = TEXT('1') + j;
         szMRU[i][2] = TEXT(' ');

         // Add the item to our menu.
         InsertMenu(hMenu, 4 + j, MF_BYPOSITION | MF_STRING, MRU_START_ID + j,
                    szMRU[i]);

         // Increment our actual MRU count.
         j++;
      }
   }
}

//******************************************************************************
void RemoveFileFromMRU(LPCTSTR szFile) {

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   }

   //---------------------------------------------------------------------------
   // We next thing we do is look for this file in our local MRU stored in our
   // File menu.  We read the current MRU list from the menu, and then write it
   // back while removing all occurrances of the file specified.
   //---------------------------------------------------------------------------

   // Get our menu handle.
#ifdef _WIN32_WCE
   HMENU hMenu = GetSubMenu(CommandBar_GetMenu(g_hWndCmdBar, 0), 0);
#else
   HMENU hMenu = GetSubMenu(GetMenu(g_hWndMain), 0);
#endif

   // Read all our current MRUs from our File Menu.
   for (i = 0, fFound = FALSE; i < MRU_MAX_FILE; i++) {

      // Query our file Menu for a MRU file.
      if (!GetMenuString(hMenu, MRU_START_ID + i, szMRU[i], countof(szMRU[0]),
          MF_BYCOMMAND))
      {
         szMRU[i][3] = TEXT('\0');
      }

      // Check for a match.
      if (!_tcsicmp(szFile, &szMRU[i][3])) {
         szMRU[i][3] = TEXT('\0');
         fFound = TRUE;
      }
   }

   // Only update menu if we found a file to remove.
   if (fFound) {

      // Clear out our menu's MRU list.
      for (i = MRU_START_ID; i < (MRU_START_ID + MRU_MAX_FILE); i++) {
         DeleteMenu(hMenu, i, MF_BYCOMMAND);
      }

      // Write the rest of our MRU list back to the menu.
      for (i = 0, j = 0; i < MRU_MAX_FILE; i++) {

         // If this MRU still exists, then add it.
         if (szMRU[i][3]) {

            // Build the accelerator prefix for this menu item.
            szMRU[i][0] = TEXT('&');
            szMRU[i][1] = TEXT('1') + j;
            szMRU[i][2] = TEXT(' ');

            // Add the item to our menu.
            InsertMenu(hMenu, 4 + j, MF_BYPOSITION | MF_STRING, MRU_START_ID + j,
                       szMRU[i]);

            // Increment our actual MRU count.
            j++;
         }
      }
   }
}

//******************************************************************************
void ActivateMRU(UINT uIDItem) {
   TCHAR szFile[_MAX_PATH + 4];

   // Get our menu handle.
#ifdef _WIN32_WCE
   HMENU hMenu = GetSubMenu(CommandBar_GetMenu(g_hWndCmdBar, 0), 0);
#else
   HMENU hMenu = GetSubMenu(GetMenu(g_hWndMain), 0);
#endif

   // Query our menu for the selected MRU.
   if (GetMenuString(hMenu, uIDItem, szFile, countof(szFile), MF_BYCOMMAND)) {

      // Move past 3 character accelerator prefix and open the file.
      ReadZipFileList(&szFile[3]);
   }
}


//******************************************************************************
//***** Open Zip File Functions
//******************************************************************************

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   g_fLoading = TRUE;
   DrawBanner(NULL);

   // Update our caption to show that we are loading.
   SetCaptionText(TEXT("Loading"));

   // Clear our list view.
   ListView_DeleteAllItems(g_hWndList);

   // Ghost all our Unzip related menu items.
   EnableAllMenuItems(IDM_FILE_PROPERTIES,    FALSE);
   EnableAllMenuItems(IDM_ACTION_EXTRACT,     FALSE);
   EnableAllMenuItems(IDM_ACTION_EXTRACT_ALL, FALSE);
   EnableAllMenuItems(IDM_ACTION_TEST,        FALSE);
   EnableAllMenuItems(IDM_ACTION_TEST_ALL,    FALSE);
   EnableAllMenuItems(IDM_ACTION_VIEW,        FALSE);
   EnableAllMenuItems(IDM_ACTION_SELECT_ALL,  FALSE);
   EnableAllMenuItems(IDM_VIEW_COMMENT,       FALSE);

   // Let Info-ZIP and our callbacks do the work.
   SendMessage(g_hWndList, WM_SETREDRAW, FALSE, 0);
   int result = DoListFiles(g_szZipFile);
   SendMessage(g_hWndList, WM_SETREDRAW, TRUE, 0);

   // Restore/remove cursor.
   SetCursor(hCur);

   // Update our column widths

unzip-6.0/wince/winmain.cpp  view on Meta::CPAN

   if ((result == PK_OK) || (result == PK_WARN)) {

      // Sort the items by name.
      Sort(0, TRUE);

      // Update this file to our MRU list and menu.
      AddFileToMRU(g_szZipFile);

      // Enabled the comment button if the zip file has a comment.
      if (lpUserFunctions->cchComment) {
         EnableAllMenuItems(IDM_VIEW_COMMENT, TRUE);
      }

      // Update other items that are related to having a Zip file loaded.
      EnableAllMenuItems(IDM_ACTION_EXTRACT_ALL, TRUE);
      EnableAllMenuItems(IDM_ACTION_TEST_ALL,    TRUE);
      EnableAllMenuItems(IDM_ACTION_SELECT_ALL,  TRUE);

   } else {

      // Make sure we didn't partially load and added a few files.
      ListView_DeleteAllItems(g_hWndList);

      // If the file itself is bad or missing, then remove it from our MRU.
      if ((result == PK_ERR) || (result == PK_BADERR) || (result == PK_NOZIP) ||
          (result == PK_FIND) || (result == PK_EOF))
      {



( run in 0.486 second using v1.01-cache-2.11-cpan-49f99fa48dc )