Example #1
0
/*
 * Process a "/reference" option.
 */
static void referenceOption(char *arg)
{
	char **refs = 0;
	int num_refs = 0;
	int posn, len;
	AddStrings(&refs, &num_refs, arg);
	for(posn = 0; posn < num_refs; ++posn)
	{
		len = strlen(refs[posn]);
		while(len > 0 && refs[posn][len - 1] != '/' &&
		      refs[posn][len - 1] != '\\' &&
			  refs[posn][len - 1] != ':')
		{
			--len;
		}
		CCStringListAdd(&libraries, &num_libraries, refs[posn] + len);
		if(len > 0)
		{
			if(len > 1 && refs[posn][len - 1] != ':' &&
			   refs[posn][len - 2] != '/' &&
			   refs[posn][len - 2] != '\\' &&
			   refs[posn][len - 2] != ':')
			{
				--len;
			}
			AddNString(&link_dirs, &num_link_dirs, refs[posn], len);
		}
	}
}
Example #2
0
LRESULT CDCSettings::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	USES_CONVERSION;

	AddStrings(m_hWnd, IDC_CAMERA_TYPE, g_rgszCameraTypes);
	AddStrings(m_hWnd, IDC_DEVICE, g_rgszDevices);
	AddStrings(m_hWnd, IDC_SPEED, g_rgszSpeeds);
	AddStrings(m_hWnd, IDC_RESIZE_MODE, g_rgszResizeModes);
	AddStrings(m_hWnd, IDC_STRETCH_MODE, g_rgszStretchModes);

	SendDlgItemMessage(IDC_CAMERA_TYPE, CB_SETCURSEL, 
		(WPARAM)m_fCameraType - 1, 0);

	CComBSTR strDevice = m_strDevice;
	if(!strDevice.Length())
		strDevice = g_szAutomatic;
	SetDlgItemText(IDC_DEVICE, OLE2T(strDevice));
	
	if(m_nSpeed == 0)
		SetDlgItemText(IDC_SPEED, g_szAutomatic);
	else
		SetDlgItemInt(IDC_SPEED, m_nSpeed);

	SendDlgItemMessage(IDC_RESIZE_MODE, CB_SETCURSEL, 
		(WPARAM)m_fResizeMode - 1, 0);
	SendDlgItemMessage(IDC_STRETCH_MODE, CB_SETCURSEL, 
		(WPARAM)m_fStretchMode - 1, 0);

	SetDlgItemInt(IDC_DESIGN_WIDTH, m_cxDesignWidth);
	SetDlgItemInt(IDC_DESIGN_HEIGHT, m_cyDesignHeight);

	TCHAR szBuffer[1024];
	// CComBSTR strModule  = GetModuleFilePath();
	// CComBSTR strVersion = GetFileVersion(OLE2CT(strModule));
	CComBSTR strVersion = VER_FILEVERSION_STR;
	wsprintf(szBuffer, "Image Upload Version %s", OLE2CT(strVersion));
	SetDlgItemText(IDC_VERSION, szBuffer);

	UpdateControls();

	return 1;  // Let the system set the focus
}
Example #3
0
int CToolBarCtrlZ::AddSingleString(LPCTSTR lpszText)
{
	enum {STRBUF = 512};
	TCHAR szTmpStr[STRBUF];
	int	iLen;

	::StringCchCopy(szTmpStr, STRBUF - 1, lpszText);
	iLen = _tcslen(lpszText);
	iLen = min(iLen, STRBUF - 2);
	szTmpStr[iLen + 1] = _T('\0');
	return AddStrings(szTmpStr);
}
Example #4
0
/////////////////////////////////////////////////////////////////////////////
// CMainToolBarCtrl message handlers
void CMainToolBarCtrl::Init()
{
	COLORREF crMask = RGB(255, 255, 255);
	
	CSize bitmapSize(32, 32);
	SetBitmapSize(bitmapSize);
	
	CSize buttonSize(40, 40);
	SetButtonSize(buttonSize);

	
	m_normalIL.Create(32, 32, ILC_COLOR24|ILC_MASK, 6, 1);
	UINT nBtnID[] = {IDB_TB_ADD, IDB_TB_START, IDB_TB_CLEAR, IDB_TB_EXPORT, IDB_TB_OPTION, IDB_TB_EXIT};
	COLORREF nCrMask[] = {RGB(255, 255, 255), RGB(255, 0, 255), RGB(255, 0, 255), RGB(255, 255, 255), 
		RGB(255, 255, 255), RGB(255, 255, 255)};
	int i;
	for(i = 0; i < (sizeof(nBtnID)/sizeof(nBtnID[0])); i++)
	{
		CBitmap bm;
		bm.LoadBitmap(nBtnID[i]);
		m_normalIL.Add(&bm, nCrMask[i]);
	}
	SetImageList(&m_normalIL);
	
	int nFirstButtonID = IDC_MAIN_TOOLBAR_BUTTON_FIRST;
	int m_nButtonCount = IDC_MAIN_TOOLBAR_BUTTON_LAST - nFirstButtonID + 1;
	
	int nBitmapIndex[] = {0, 1, 2, 3, 4, 5};
	TBBUTTON tb;
	for (int nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + nFirstButtonID);
		
		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR * pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;
		
		VERIFY((tb.iString = AddStrings(pString)) != -1);
		
		string.ReleaseBuffer();
		
		tb.fsState = TBSTATE_ENABLED;
		tb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE;
		tb.dwData = 0;
		tb.iBitmap = nBitmapIndex[nIndex];
		tb.idCommand = nIndex + nFirstButtonID;
		
		AddButtons(1, &tb);
	}
}
void CBrowserToolbarCtrl::Init()
{
	InitImageList();


    TBButtons[0].idCommand = TB_BACK;
	TBButtons[1].idCommand = TB_FORWARD;
	TBButtons[2].idCommand = TB_STOP;
	TBButtons[3].idCommand = TB_REFRESH;
	TBButtons[4].idCommand = TB_HOME;

	// add button-text:
	TCHAR cButtonStrings[500];
	int lLen, lLen2;
	
	_tcscpy(cButtonStrings, GetResString(IDS_BROWSER_BACK));
	lLen = _tcslen(GetResString(IDS_BROWSER_BACK)) + 1;

	lLen2 = _tcslen(GetResString(IDS_BROWSER_FORWARD)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_BROWSER_FORWARD), lLen2*sizeof(TCHAR));
	lLen += lLen2;

	lLen2 = _tcslen(GetResString(IDS_BROWSER_STOP)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_BROWSER_STOP), lLen2*sizeof(TCHAR));
	lLen += lLen2;

	lLen2 = _tcslen(GetResString(IDS_BROWSER_REFRESH)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_BROWSER_REFRESH), lLen2*sizeof(TCHAR));
	lLen += lLen2;

	lLen2 = _tcslen(GetResString(IDS_BROWSER_VERYCD)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_BROWSER_VERYCD), lLen2*sizeof(TCHAR));
	lLen += lLen2;

	// terminate
	memcpy(cButtonStrings+lLen, _T("\0"), sizeof(TCHAR));
	
	/*int iRet =*/AddStrings(cButtonStrings);

    
	for( int i = 0; i < NUM_BROWSER_BUTTON; i++ )
	{
		TBButtons[i].iBitmap = i;
		TBButtons[i].fsState = TBSTATE_ENABLED;
		TBButtons[i].fsStyle = TBSTYLE_BUTTON | BTNS_AUTOSIZE;
		TBButtons[i].iString = i;
	}

	AddButtons(NUM_BROWSER_BUTTON, TBButtons);

	Localize();
}
Example #6
0
void TStrings::Assign(const TPersistent * Source)
{
  const TStrings * Strings = NB_STATIC_DOWNCAST_CONST(TStrings, Source);
  if (Strings != nullptr)
  {
    BeginUpdate();
    SCOPE_EXIT
    {
      EndUpdate();
    };
    Clear();
    DebugAssert(Strings);
    FQuoteChar = Strings->FQuoteChar;
    FDelimiter = Strings->FDelimiter;
    AddStrings(Strings);
  }
Example #7
0
void TStrings::Assign(const TPersistent * Source)
{
  const TStrings * Strings = dynamic_cast<const TStrings *>(Source);
  if (Strings != nullptr)
  {
    BeginUpdate();
    SCOPE_EXIT
    {
      EndUpdate();
    };
    {
      Clear();
      assert(Strings);
      FQuoteChar = Strings->FQuoteChar;
      FDelimiter = Strings->FDelimiter;
      AddStrings(Strings);
    }
  }
Example #8
0
/*
 * Process a "/resource" option.
 */
static void resourceOption(char *arg)
{
	char **refs = 0;
	int num_refs = 0;
	int posn;
	char *combined;
	AddStrings(&refs, &num_refs, arg);
	for(posn = 0; posn < num_refs; ++posn)
	{
		combined = (char *)ILMalloc(strlen(refs[posn]) + 11);
		if(!combined)
		{
			CCOutOfMemory();
		}
		strcpy(combined, "resources=");
		strcat(combined, refs[posn]);
		CCStringListAdd(&extension_flags, &num_extension_flags, combined);
	}
}
Example #9
0
BOOL CPaletteBar::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID )
{
	BOOL bRet = CToolBarCtrl::Create(dwStyle, rect, pParentWnd, nID);

	m_nButtonCount = ID_ELLIPSE - ID_ERASE + 1;

	VERIFY(AddBitmap(m_nButtonCount,IDR_PALETTEBAR) != -1);

	m_pTBButtons = new TBBUTTON[m_nButtonCount];

	int nIndex;
	for (nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + ID_ERASE);

		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR* pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;

		VERIFY((m_pTBButtons[nIndex].iString = AddStrings(pString)) != -1);

		string.ReleaseBuffer();


		m_pTBButtons[nIndex].fsState = TBSTATE_ENABLED;
		m_pTBButtons[nIndex].fsStyle = TBSTYLE_CHECKGROUP;
		m_pTBButtons[nIndex].dwData = 0;
		m_pTBButtons[nIndex].iBitmap = nIndex;
		m_pTBButtons[nIndex].idCommand = nIndex + ID_ERASE;

	}


	for (nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		VERIFY(AddButtons(1,&m_pTBButtons[nIndex]));
	}


	return bRet;
}
Example #10
0
void TStrings::Assign(const TPersistent * Source)
{
  const TStrings * Strings = dynamic_cast<const TStrings *>(Source);
  if (Strings != nullptr)
  {
    BeginUpdate();
    auto cleanup = finally([&]()
    {
      EndUpdate();
    });
    {
      Clear();
      assert(Strings);
      FQuoteChar = Strings->FQuoteChar;
      FDelimiter = Strings->FDelimiter;
      AddStrings(Strings);
    }
  }
  else
  {
    TPersistent::Assign(Source);
  }
}
Example #11
0
/////////////////////////////////////////////////////////////////////////////
// CMyToolBarCtrl message handlers
void CMyToolBarCtrl::Init()
{
	COLORREF crMask = RGB(255, 0, 255);
	CBitmap tbBitmap;
	tbBitmap.LoadBitmap(IDB_TB_HOT);
	
	BITMAP bmpInfo;
	tbBitmap.GetBitmap(&bmpInfo);
	
	CSize bitmapSize(bmpInfo.bmHeight - 2, bmpInfo.bmHeight);
	SetBitmapSize(bitmapSize);
	
	CSize buttonSize(bmpInfo.bmHeight + 7, bmpInfo.bmHeight + 7);
	SetButtonSize(buttonSize);
	
	m_normalIL.Create(bmpInfo.bmHeight - 2, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1);
	m_normalIL.Add(&tbBitmap, crMask);
	SetImageList(&m_normalIL);
	tbBitmap.DeleteObject();

	tbBitmap.LoadBitmap(IDB_TB_HOT);
	m_hotIL.Create(bmpInfo.bmHeight - 2, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1);
	m_hotIL.Add(&tbBitmap, crMask);
	SetHotImageList(&m_hotIL);
	tbBitmap.DeleteObject();

	tbBitmap.LoadBitmap(IDB_TB_HOT);
	m_disableIL.Create(bmpInfo.bmHeight - 2, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1);
	m_disableIL.Add(&tbBitmap, crMask);
	SetDisabledImageList(&m_disableIL);
	tbBitmap.DeleteObject();

	int nFirstButtonID = FISRT_TOOLBAR_BUTTON_ID;
	int m_nButtonCount = LAST_TOOLBAR_BUTTON_ID - nFirstButtonID + 1;
	
	TBBUTTON tb;
	for (int nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + nFirstButtonID);
		
		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR * pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;
		
		VERIFY((tb.iString = AddStrings(pString)) != -1);
		
		string.ReleaseBuffer();
		
		tb.fsState = TBSTATE_ENABLED;
		tb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE;
		tb.dwData = 0;
		tb.iBitmap = nIndex;
		tb.idCommand = nIndex + nFirstButtonID;
		if(tb.idCommand >= TBBTN_DUMMY2)
		{
			tb.fsState = 0;
		}
		
		AddButtons(1, &tb);
	}
}
Example #12
0
/*
 * Process a "/lib" option.
 */
static void libOption(char *arg)
{
	AddStrings(&link_dirs, &num_link_dirs, arg);
}
Example #13
0
/*
 * Process a "/define" option.
 */
static void defineOption(char *arg)
{
	AddStrings(&user_defined_symbols, &num_user_defined_symbols, arg);
}
Example #14
0
void CMuleToolbarCtrl::Init(void)
{
	m_astrToolbarPaths.RemoveAll();

	// Win98: Explicitly set to Unicode to receive Unicode notifications.
	SendMessage(CCM_SETUNICODEFORMAT, TRUE);

	ModifyStyle(0, TBSTYLE_FLAT | TBSTYLE_ALTDRAG | CCS_ADJUSTABLE | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER);
	if (thePrefs.GetUseReBarToolbar())
	{
		ModifyStyle(0, CCS_NORESIZE);
		SetExtendedStyle(GetExtendedStyle() | TBSTYLE_EX_HIDECLIPPEDBUTTONS);
	}

	ChangeToolbarBitmap(thePrefs.GetToolbarBitmapSettings(), false);

	// add button-text:
	TCHAR cButtonStrings[2000];
	int lLen, lLen2;
	m_buttoncount = 0;
	
	_tcscpy(cButtonStrings, GetResString(IDS_MAIN_BTN_CONNECT));
	lLen = _tcslen(GetResString(IDS_MAIN_BTN_CONNECT)) + 1;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_KADEMLIA)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_KADEMLIA), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_SERVER)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_SERVER), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_TRANS)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_TRANS), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_SEARCH)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_SEARCH), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_FILES)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_FILES), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_MESSAGES)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_MESSAGES), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

#ifdef IRC
	lLen2 = _tcslen(GetResString(IDS_IRC)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_IRC), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;
#endif

	lLen2 = _tcslen(GetResString(IDS_EM_STATISTIC)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_STATISTIC), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_PREFS)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_PREFS), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_TOOLS)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_TOOLS), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

	lLen2 = _tcslen(GetResString(IDS_EM_HELP)) + 1;
	memcpy(cButtonStrings+lLen, GetResString(IDS_EM_HELP), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;

#ifdef MOD_SUNYAN
	lLen2 = _tcslen(GetResString(IDS_DMIBOX)) + 1;
	memcpy(cButtonStrings+lLen,GetResString(IDS_DMIBOX), lLen2*sizeof(TCHAR));
	lLen += lLen2;
	++m_buttoncount;
#endif

	// terminate
	memcpy(cButtonStrings+lLen, _T("\0"), sizeof(TCHAR));

	AddStrings(cButtonStrings);

	// initialize buttons:	
	for(int i = 0; i < m_buttoncount; i++)
	{		
		TBButtons[i].fsState	= TBSTATE_ENABLED;
		TBButtons[i].fsStyle	= TBSTYLE_CHECKGROUP;
		TBButtons[i].idCommand	= IDC_TOOLBARBUTTON + i;
		TBButtons[i].iString	= i;

		switch (TBButtons[i].idCommand)
		{
			case TBBTN_CONNECT:
			case TBBTN_OPTIONS:
			case TBBTN_TOOLS:
			case TBBTN_HELP:
				TBButtons[i].fsStyle = TBSTYLE_BUTTON;
				break;
		}
	}

	// set button image indices
	int iBitmap = 0;
	for (int i = 0; i < m_buttoncount; i++)
	{		
		TBButtons[i].iBitmap = iBitmap;
		if (TBButtons[i].idCommand == TBBTN_CONNECT) // 'Connect' button has 3 states
			iBitmap += 3;
		else
			iBitmap += 1;
	}
	
	TBBUTTON sepButton = {0};
	sepButton.idCommand = 0;
	sepButton.fsStyle = TBSTYLE_SEP;
	sepButton.fsState = TBSTATE_ENABLED;
	sepButton.iString = -1;
	sepButton.iBitmap = -1;
	
	CString config = thePrefs.GetToolbarSettings();
	for (int i = 0; i < config.GetLength(); i += 2)
	{
		int index = _tstoi(config.Mid(i, 2));
		if (index == 99)
		{
			AddButtons(1, &sepButton);
			continue;
		}
		AddButtons(1, &TBButtons[index]);
	}

	// recalc toolbar-size
	SetAllButtonsStrings();
	ChangeTextLabelStyle(thePrefs.GetToolbarLabelSettings(), false, true);
	SetAllButtonsWidth();	// then calc and set the button width
	AutoSize();				// and finally call the original (but maybe obsolete) function
	SaveCurHeight();
}
Example #15
0
int main(int argc, char* argv[]) {
  ZopfliOptions options;
  ZopfliFormat output_type = ZOPFLI_FORMAT_GZIP;
  const char* filename = 0;
  int output_to_stdout = 0;
  int i;

  ZopfliInitOptions(&options);

  for (i = 1; i < argc; i++) {
    const char* arg = argv[i];
    if (StringsEqual(arg, "-v")) options.verbose = 1;
    else if (StringsEqual(arg, "-c")) output_to_stdout = 1;
    else if (StringsEqual(arg, "--deflate")) {
      output_type = ZOPFLI_FORMAT_DEFLATE;
    }
    else if (StringsEqual(arg, "--zlib")) output_type = ZOPFLI_FORMAT_ZLIB;
    else if (StringsEqual(arg, "--gzip")) output_type = ZOPFLI_FORMAT_GZIP;
    else if (StringsEqual(arg, "--splitlast")) options.blocksplittinglast = 1;
    else if (arg[0] == '-' && arg[1] == '-' && arg[2] == 'i'
        && arg[3] >= '0' && arg[3] <= '9') {
      options.numiterations = atoi(arg + 3);
    }
    else if (StringsEqual(arg, "-h")) {
      fprintf(stderr,
          "Usage: zopfli [OPTION]... FILE...\n"
          "  -h    gives this help\n"
          "  -c    write the result on standard output, instead of disk"
          " filename + '.gz'\n"
          "  -v    verbose mode\n"
          "  --i#  perform # iterations (default 15). More gives"
          " more compression but is slower."
          " Examples: --i10, --i50, --i1000\n");
      fprintf(stderr,
          "  --gzip        output to gzip format (default)\n"
          "  --zlib        output to zlib format instead of gzip\n"
          "  --deflate     output to deflate format instead of gzip\n"
          "  --splitlast   do block splitting last instead of first\n");
      return 0;
    }
  }

  if (options.numiterations < 1) {
    fprintf(stderr, "Error: must have 1 or more iterations");
    return 0;
  }

  for (i = 1; i < argc; i++) {
    if (argv[i][0] != '-') {
      char* outfilename;
      filename = argv[i];
      if (output_to_stdout) {
        outfilename = 0;
      } else if (output_type == ZOPFLI_FORMAT_GZIP) {
        outfilename = AddStrings(filename, ".gz");
      } else if (output_type == ZOPFLI_FORMAT_ZLIB) {
        outfilename = AddStrings(filename, ".zlib");
      } else {
        assert(output_type == ZOPFLI_FORMAT_DEFLATE);
        outfilename = AddStrings(filename, ".deflate");
      }
      if (options.verbose && outfilename) {
        fprintf(stderr, "Saving to: %s\n", outfilename);
      }
      CompressFile(&options, output_type, filename, outfilename);
      free(outfilename);
    }
  }

  if (!filename) {
    fprintf(stderr,
            "Please provide filename\nFor help, type: %s -h\n", argv[0]);
  }

  return 0;
}