Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
dlgman.cpp File Reference
#include <windows.h>
#include <windowsx.h>
#include <assert.h>
#include "resource.h"
#include "plugin.h"
#include "helpers.h"
#include "guihlp.h"
#include "guiprefs.h"
#include "winutils.h"
#include "xp.h"

Go to the source code of this file.

Functions

static void onCommand (HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
static BOOL onInitDialog (HWND hWnd, HWND hWndFocus, LPARAM lParam)
static void onDestroy (HWND hWnd)
BOOL CALLBACK NP_LOADDS ManualDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Variables

CLoggerpLogger

Function Documentation

BOOL CALLBACK NP_LOADDS ManualDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 211 of file dlgman.cpp.

{
  switch(msg)
  {
    case WM_INITDIALOG:
      return (BOOL)HANDLE_WM_INITDIALOG(hWnd, wParam, lParam, onInitDialog);
    case WM_COMMAND:
      HANDLE_WM_COMMAND(hWnd, wParam, lParam, onCommand);
      break;
    case WM_DESTROY:
      HANDLE_WM_DESTROY(hWnd, wParam, lParam, onDestroy);
      break;

    default:
      return FALSE;
  }
  return TRUE;
}

Here is the call graph for this function:

static void onCommand ( HWND  hWnd,
int  id,
HWND  hWndCtl,
UINT  codeNotify 
) [static]

Definition at line 53 of file dlgman.cpp.

{
  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
  if (!pPlugin)
    return;

  switch (id)
  {
    case IDC_COMBO_API_CALL:
      if(codeNotify != CBN_SELCHANGE)
        break;
      updateUI(hWnd);
      break;
    case IDC_BUTTON_GO:
      pLogger->blockDumpToFile(FALSE);
      onGo(hWnd);
      break;
    case IDC_EDIT_ARG1:
    case IDC_EDIT_ARG2:
    case IDC_EDIT_ARG3:
    case IDC_EDIT_ARG4:
    case IDC_EDIT_ARG5:
    case IDC_EDIT_ARG6:
    case IDC_EDIT_ARG7:
    {
      if(codeNotify == EN_SETFOCUS)
        pPlugin->m_hWndLastEditFocus = hWndCtl;

      char szString[80];
      char szEdit[128];
      int iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL));
      ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_API_CALL), iIndex, szString);
      if(   ((strcmp(szString, STRING_NPN_POSTURL) == 0) || (strcmp(szString, STRING_NPN_POSTURLNOTIFY) == 0))
         && (id == IDC_EDIT_ARG5)
         && (codeNotify == EN_CHANGE))
      {
        Edit_GetText(hWndCtl, szEdit, sizeof(szEdit));
        int iLength = strlen(szEdit);
        SetDlgItemInt(hWnd, IDC_EDIT_ARG4, iLength, FALSE);
      }
      if(   ((strcmp(szString, STRING_NPN_WRITE) == 0))
         && (id == IDC_EDIT_ARG4)
         && (codeNotify == EN_CHANGE))
      {
        Edit_GetText(hWndCtl, szEdit, sizeof(szEdit));
        int iLength = strlen(szEdit);
        SetDlgItemInt(hWnd, IDC_EDIT_ARG3, iLength, FALSE);
      }

      // save values of window size on the fly as we type it
      if(    (strcmp(szString, STRING_NPN_SETVALUE) == 0)
          && ((id == IDC_EDIT_ARG3) || (id == IDC_EDIT_ARG4)) 
          && (codeNotify == EN_CHANGE)
          && (hWndCtl == GetFocus()))
      {
        iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_ARG2));
        ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_ARG2), iIndex, szString);
        if(strcmp(szString, "NPPVpluginWindowSize") == 0)
        {
          BOOL bTranslated = FALSE;
          int iWidth = GetDlgItemInt(hWnd, IDC_EDIT_ARG3, &bTranslated, TRUE);
          int iHeight = GetDlgItemInt(hWnd, IDC_EDIT_ARG4, &bTranslated, TRUE);

          if(pPlugin->m_iWidth != iWidth)
            pPlugin->m_iWidth = iWidth;
          if(pPlugin->m_iHeight != iHeight)
            pPlugin->m_iHeight = iHeight;
        }
      }
      break;
    }
    case IDC_COMBO_ARG2:
    {
      if(codeNotify != CBN_SELCHANGE)
        break;

      ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARG4), SW_HIDE);
      ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG4), SW_HIDE);
      Static_SetText(GetDlgItem(hWnd, IDC_STATIC_ARG3), "*value:");
      Edit_SetText(GetDlgItem(hWnd, IDC_EDIT_ARG3), "");

      char szString[80];
      int iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL));
      ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_API_CALL), iIndex, szString);
      if(strcmp(szString, STRING_NPN_SETVALUE) == 0)
      {
        iIndex = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_ARG2));
        ComboBox_GetLBText(GetDlgItem(hWnd, IDC_COMBO_ARG2), iIndex, szString);
        if((strcmp(szString, "NPPVpluginWindowBool") == 0) ||
           (strcmp(szString, "NPPVpluginTransparentBool") == 0) ||
           (strcmp(szString, "NPPVpluginKeepLibraryInMemory") == 0))
        {
          HWND hWndCombo = GetDlgItem(hWnd, IDC_COMBO_ARG3);
          ComboBox_ResetContent(hWndCombo);
          ComboBox_AddString(hWndCombo, "TRUE");
          ComboBox_AddString(hWndCombo, "FALSE");
          ComboBox_SetCurSel(hWndCombo, 0);
          ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG3), SW_HIDE);
          ShowWindow(hWndCombo, SW_SHOW);
        }
        else
        {
          ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG3), SW_SHOW);
          ShowWindow(GetDlgItem(hWnd, IDC_COMBO_ARG3), SW_HIDE);
          if(strcmp(szString, "NPPVpluginWindowSize") == 0)
          {
            EnableWindow(GetDlgItem(hWnd, IDC_EDIT_ARG4), TRUE);
            ShowWindow(GetDlgItem(hWnd, IDC_EDIT_ARG4), SW_SHOW);
            ShowWindow(GetDlgItem(hWnd, IDC_STATIC_ARG4), SW_SHOW);
            Static_SetText(GetDlgItem(hWnd, IDC_STATIC_ARG3), "width:");
            Static_SetText(GetDlgItem(hWnd, IDC_STATIC_ARG4), "height:");
            SetDlgItemInt(hWnd, IDC_EDIT_ARG3, pPlugin->m_iWidth, TRUE);
            SetDlgItemInt(hWnd, IDC_EDIT_ARG4, pPlugin->m_iHeight, TRUE);
          }
        }
      }
      break;
    }
    case IDC_BUTTON_PASTE:
      onPaste(pPlugin->m_hWndLastEditFocus);
      break;
    default:
      break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void onDestroy ( HWND  hWnd) [static]

Definition at line 199 of file dlgman.cpp.

{
  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
  if(pPlugin && pPlugin->m_Pref_bRememberLastCall) {
    // save last API call if needed
    char szFileName[_MAX_PATH];
    GetINIFileName(pPlugin->getInstance(), szFileName, sizeof(szFileName));
    int iSel = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL));
    XP_WritePrivateProfileInt(SECTION_PREFERENCES, KEY_LAST_API_CALL, iSel, szFileName);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL onInitDialog ( HWND  hWnd,
HWND  hWndFocus,
LPARAM  lParam 
) [static]

Definition at line 179 of file dlgman.cpp.

{
  CPlugin * pPlugin = (CPlugin *)lParam;
  SetWindowLong(hWnd, DWL_USER, (long)pPlugin);

  // look at the last used API call if needed
  int iSel = 0;
  if (pPlugin && pPlugin->m_Pref_bRememberLastCall) {
    char szFileName[_MAX_PATH];
    GetINIFileName(pPlugin->getInstance(), szFileName, sizeof(szFileName));
    iSel = XP_GetPrivateProfileInt(SECTION_PREFERENCES, KEY_LAST_API_CALL, 0, szFileName);
  }
  fillAPIComboBoxAndSetSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL), iSel);
  updateUI(hWnd);

  int iTopMargin = 188;
  SetWindowPos(hWnd, NULL, 0,iTopMargin, 0,0, SWP_NOZORDER | SWP_NOSIZE);
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 47 of file np_entry.cpp.