Compare commits

..

18 Commits

Author SHA1 Message Date
winesync
28e8839533 [WINESYNC]: setupapi/stringtable_wine.c is now in sync with wine-staging wine-8.15 2023-09-22 13:14:55 +02:00
winesync
3e8e6ea939 [WINESYNC] setupapi: Use CRT functions for memory allocation where possible.
The big win here is getting rid of the reimplementation of wcsdup.

wine commit id c293cd781fb4b330b7d93171501134f86a5138b8 by Alex Henrie <alexhenrie24@gmail.com>
2023-09-22 13:14:54 +02:00
winesync
9668f09b8d [WINESYNC] setupapi: Move prototypes not in Windows's setupapi.h to setupapi_private.h.
And delete the ones we don't need.

wine commit id 1172e66e5b7fa96decf89f8866e71b77e5773ec7 by Alex Henrie <alexhenrie24@gmail.com>

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-09-22 13:14:53 +02:00
winesync
c1c6d3c0af [WINESYNC] setupapi: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id e498e0ec9bf5a3f9cdb965f8668888697ac642ae by Eric Pouech <eric.pouech@gmail.com>
2023-09-22 13:14:53 +02:00
winesync
5302298e6a [WINESYNC] setupapi: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 72d6759f3a86c24e2db0b6190f4d2fae642e487f by Alexandre Julliard <julliard@winehq.org>
2023-09-22 13:14:52 +02:00
Hermès Bélusca-Maïto
b5effae6c5 Now compile wine's stringtable.c for testing purposes 2023-09-22 13:14:51 +02:00
Hermès Bélusca-Maïto
25cdc2b7f1 [WINESYNC] setupapi: Implement a binary compatible string table.
wine commit id 8802f84c8cc473d5617c134c16973b1cb2c4b53e by Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 13:14:50 +02:00
Hermès Bélusca-Maïto
156ffcd20e [SETUPAPI][WINESYNC] Continue Wine-syncing stringtable.c to a separate file.
Past Wine 1.7.18, the string table internal structure changed to one
claimed to be "binary compatible" (with Windows' one), see wine commit
8802f84c8cc473d5617c134c16973b1cb2c4b53e , with a "weak" justification
that may be found in
https://bugs.winehq.org/show_bug.cgi?id=26016
and
https://bugs.winehq.org/show_bug.cgi?id=32554

Until we hit actual problems with our stringtable implementation, keep
it in its original file, while this new Wine implementation goes into
a separate file, that could be tested manually by changing which one is
compiled in the CMakeLists.txt file.
2023-09-22 13:14:49 +02:00
Hermès Bélusca-Maïto
ad1cff5925 [SETUPAPI] stringtable.c: Code simplification and bugfix.
- Reimplement StringTableInitialize around StringTableInitializeEx
- Fix buffer over-read in StringTableGetExtraData in case the user-specified
  dwExtraDataSize is larger than the dwSize of the pStringTable pData buffer.
2023-09-22 13:14:49 +02:00
winesync
12384ee60c [WINESYNC]: setupapi/stringtable.c is now in sync with wine-staging wine-1.7.18 2023-09-22 13:14:48 +02:00
winesync
c7915227d3 [WINESYNC] setupapi: Implement StringTableLookUpStringEx.
wine commit id 18b5366c35f95eb6e7fc6e19c50c371a81d5a980 by Hans Leidekker <hans@codeweavers.com>

[WINESYNC] setupapi: Add some tests for StringTableLookUpStringEx. Make them pass.

wine commit id 601870a4351753555bfa351a23328b2e1109c7b0 by Hans Leidekker <hans@codeweavers.com>

[WINESYNC] setupapi: Fix the StringTableLookUpStringEx() prototype.

wine commit id 916d6a44500735b3fecf0e7c485c2aa7e8025644 by Francois Gouget <fgouget@free.fr>

These commits have been grouped together, since all of these were
partially already present in the forked stringtable.c code.
2023-09-22 13:14:47 +02:00
winesync
55cbd14f25 [WINESYNC] setupapi: Fix typo in StringTableGetExtraData.
wine commit id d8dad22c9783e1868ec4bb72d8051dd0a5f4f0a7 by Hans Leidekker <hans@codeweavers.com>
2023-09-22 13:14:46 +02:00
winesync
38a7d21adb [WINESYNC] setupapi: Implement StringTableAddStringEx.
wine commit id c2f99f30143e1180620980f3d5713456392c8ecf by Hans Leidekker <hans@codeweavers.com>

+ Re-integrate existing ReactOS bug fixes
+ Add missing dwExtraDataSize && lpExtraData zero/NULL checks in StringTableAddStringEx

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-09-22 13:14:45 +02:00
winesync
65d0db3da7 [WINESYNC] setupapi: Do not cast NULL.
wine commit id d62b48df2acece81b533a92fbca566cc4023be43 by Michael Stefaniuc <mstefani@redhat.de>
2023-09-22 13:14:44 +02:00
winesync
408165bc85 [WINESYNC] setupapi: setupapi.h must not define HSTRING_TABLE and the StringTable* prototypes.
wine commit id 7ab6d8522b614f6e9d9773fa86151ab05fb05a19 by Francois Gouget <fgouget@free.fr>

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2023-09-22 13:14:43 +02:00
Hermès Bélusca-Maïto
7a1f611ea8 [WINESYNC] Initial bootstrap for setupapi stringtable.c partial sync.
Start syncing at wine-0.9.24
2023-09-22 13:14:43 +02:00
Hermès Bélusca-Maïto
14f7a7688b Partially revert commit 30810893ad.
[SETUPAPI]
- Add 'pSetup'-Prefix to the string table functions according to the new naming convention.
- Remove the obsolete function StringTableTrim.
2023-09-22 13:14:42 +02:00
Hermès Bélusca-Maïto
d5255afce9 [SETUPAPI] Use the CRT oldnames library.
Remove the '-Dwcsnicmp=_wcsnicmp' and use the alias in the oldnames lib.
This will also fix wcslwr() usage in next commits.
2023-09-22 13:14:27 +02:00
1093 changed files with 20769 additions and 53425 deletions

View File

@@ -336,12 +336,14 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
add_subdirectory(sdk/include/reactos/mc)
add_subdirectory(sdk/include/asm)
if(ARCH MATCHES "64$")
include(sdk/cmake/baseaddress64.cmake)
elseif(NO_ROSSYM)
if(NO_ROSSYM)
include(sdk/cmake/baseaddress_dwarf.cmake)
elseif(MSVC)
include(sdk/cmake/baseaddress_msvc.cmake)
if (ARCH STREQUAL "amd64")
include(sdk/cmake/baseaddress_msvc_x64.cmake)
else()
include(sdk/cmake/baseaddress_msvc.cmake)
endif()
else()
include(sdk/cmake/baseaddress.cmake)
endif()

View File

@@ -1,4 +1,5 @@
#pragma once
#ifndef __CALC_H__
#define __CALC_H__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -15,7 +16,6 @@
#include <htmlhelp.h>
#endif
#include <limits.h>
#include <strsafe.h>
/* RESOURCES */
#include "resource.h"
@@ -280,3 +280,5 @@ INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
void ConvExecute(HWND hWnd);
void ConvAdjust(HWND hWnd, int n_cat);
void ConvInit(HWND hWnd);
#endif /* __CALC_H__ */

View File

@@ -429,8 +429,8 @@ END
/* Angles */
STRINGTABLE
BEGIN
IDS_ANGLE_ARCMINUTES "Угловая минута"
IDS_ANGLE_ARCSECONDS "Угловая секунда"
IDS_ANGLE_ARCMINUTES "Minute of arc"
IDS_ANGLE_ARCSECONDS "Second of arc"
IDS_ANGLE_DEGREES "градус"
IDS_ANGLE_GRADIANS "град"
IDS_ANGLE_RADIANS "радиан"

View File

@@ -19,7 +19,7 @@
*/
#include <windef.h>
#include <winuser.rh>
#include <winuser.h>
#include "resource.h"

View File

@@ -27,7 +27,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
switch (base) {
case IDC_RADIO_HEX:
StringCchPrintf(buffer, size, _T("%I64X"), rpn->i);
_stprintf(buffer, _T("%I64X"), rpn->i);
break;
case IDC_RADIO_DEC:
/*
@@ -40,11 +40,11 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
/* calculate the width of integer number */
width = (rpn->f==0) ? 1 : (int)log10(fabs(rpn->f))+1;
if (calc.sci_out == TRUE || width > MAX_LD_WIDTH || width < -MAX_LD_WIDTH)
StringCchPrintf(buffer, size, _T("%#.*e"), MAX_LD_WIDTH-1, rpn->f);
_stprintf(buffer, _T("%#.*e"), MAX_LD_WIDTH-1, rpn->f);
else {
TCHAR *ptr, *dst;
StringCchPrintfEx(buffer, size, &ptr, NULL, 0, _T("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
ptr = buffer + _stprintf(buffer, _T("%#*.*f"), width, ((MAX_LD_WIDTH-width-1)>=0) ? MAX_LD_WIDTH-width-1 : 0, rpn->f);
/* format string ensures there is a '.': */
dst = _tcschr(buffer, _T('.'));
while (--ptr > dst)
@@ -61,7 +61,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
#undef MAX_LD_WIDTH
break;
case IDC_RADIO_OCT:
StringCchPrintf(buffer, size, _T("%I64o"), rpn->i);
_stprintf(buffer, _T("%I64o"), rpn->i);
break;
case IDC_RADIO_BIN:
if (rpn->i == 0) {

View File

@@ -107,7 +107,7 @@ void prepare_rpn_result_2(calc_number_t *rpn, TCHAR *buffer, int size, int base)
}
mpz_clear(zz);
mpf_clear(ff);
StringCchPrintf(buffer, size, _T("%hs"), temp);
_sntprintf(buffer, SIZEOF(calc.buffer), _T("%hs"), temp);
}
void convert_text2number_2(calc_number_t *a)

View File

@@ -254,10 +254,10 @@ static void UpdateNumberIntl(void)
{
/* Get current user defaults */
if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, calc.sDecimal, SIZEOF(calc.sDecimal)))
StringCbCopy(calc.sDecimal, sizeof(calc.sDecimal), _T("."));
_tcscpy(calc.sDecimal, _T("."));
if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, calc.sThousand, SIZEOF(calc.sThousand)))
StringCbCopy(calc.sThousand, sizeof(calc.sThousand), _T(","));
_tcscpy(calc.sThousand, _T(","));
/* get the string lengths */
calc.sDecimal_len = _tcslen(calc.sDecimal);
@@ -342,7 +342,7 @@ static void save_config(void)
switch (osvi.dwPlatformId) {
case VER_PLATFORM_WIN32s:
case VER_PLATFORM_WIN32_WINDOWS:
StringCbPrintf(buf, sizeof(buf), _T("%lu"), calc.layout);
_stprintf(buf, _T("%lu"), calc.layout);
WriteProfileString(_T("SciCalc"), _T("layout"), buf);
WriteProfileString(_T("SciCalc"), _T("UseSep"), (calc.usesep==TRUE) ? _T("1") : _T("0"));
break;
@@ -496,16 +496,16 @@ static void update_lcd_display(HWND hwnd)
TCHAR tmp[MAX_CALC_SIZE * 2 + 2];
if (calc.buffer[0] == _T('\0'))
StringCbCopy(tmp, sizeof(tmp), _T("0"));
_tcscpy(tmp, _T("0"));
else
StringCbCopy(tmp, sizeof(tmp), calc.buffer);
_tcscpy(tmp, calc.buffer);
/* Add final '.' in decimal mode (if it's missing), but
* only if it's a result: no append if it prints "ERROR".
*/
if (calc.base == IDC_RADIO_DEC && !calc.is_nan) {
if (_tcschr(tmp, _T('.')) == NULL)
StringCbCat(tmp, sizeof(tmp), _T("."));
_tcscat(tmp, _T("."));
}
/* if separator mode is on, let's add an additional space */
if (calc.usesep && !calc.sci_in && !calc.sci_out && !calc.is_nan) {
@@ -573,14 +573,13 @@ static void update_parent_display(HWND hWnd)
if (!n)
str[0] = _T('\0');
else
StringCbPrintf(str, sizeof(str), _T("(=%d"), n);
_stprintf(str,_T("(=%d"), n);
SetDlgItemText(hWnd, IDC_TEXT_PARENT, str);
}
static void build_operand(HWND hwnd, DWORD idc)
{
unsigned int i = 0, n;
size_t cbPtr;
if (idc == IDC_BUTTON_DOT) {
/* if dot is the first char, it's added automatically */
@@ -618,14 +617,12 @@ static void build_operand(HWND hwnd, DWORD idc)
if (idc != IDC_STATIC)
calc.esp = (calc.esp * 10 + (key2code[i].key-'0')) % LOCAL_EXP_SIZE;
if (calc.ptr == calc.buffer)
StringCbPrintf(calc.ptr, sizeof(calc.buffer), _T("0.e%+d"), calc.esp);
_stprintf(calc.ptr, _T("0.e%+d"), calc.esp);
else {
/* adds the dot at the end if the number has no decimal part */
if (!_tcschr(calc.buffer, _T('.')))
*calc.ptr++ = _T('.');
cbPtr = sizeof(calc.buffer) - ((BYTE*)calc.ptr - (BYTE*)calc.buffer);
StringCbPrintf(calc.ptr, cbPtr, _T("e%+d"), calc.esp);
_stprintf(calc.ptr, _T("e%+d"), calc.esp);
}
update_lcd_display(hwnd);
return;
@@ -640,11 +637,7 @@ static void build_operand(HWND hwnd, DWORD idc)
return;
break;
}
cbPtr = sizeof(calc.buffer) - ((BYTE*)calc.ptr - (BYTE*)calc.buffer);
StringCbPrintfEx(calc.ptr, cbPtr, &calc.ptr, NULL, STRSAFE_FILL_ON_FAILURE,
_T("%C"), key2code[i].key);
calc.ptr += _stprintf(calc.ptr, _T("%C"), key2code[i].key);
update_lcd_display(hwnd);
}
@@ -857,11 +850,11 @@ static void update_memory_flag(HWND hWnd, BOOL mem_flag)
SetDlgItemText(hWnd, IDC_TEXT_MEMORY, mem_flag ? _T("M") : _T(""));
}
static void update_n_stats_items(HWND hWnd, TCHAR *buffer, size_t cbBuffer)
static void update_n_stats_items(HWND hWnd, TCHAR *buffer)
{
unsigned int n = SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_GETCOUNT, 0, 0);
StringCbPrintf(buffer, cbBuffer, _T("n=%u"), n);
_stprintf(buffer, _T("n=%u"), n);
SetDlgItemText(hWnd, IDC_TEXT_NITEMS, buffer);
}
@@ -912,7 +905,7 @@ static char *ReadConversion(const char *formula)
str[len+1] = ')';
str[len+2] = '\0';
StringCbCopy(calc.source, sizeof(calc.source), (*calc.buffer == _T('\0')) ? _T("0") : calc.buffer);
_tcscpy(calc.source, (*calc.buffer == _T('\0')) ? _T("0") : calc.buffer);
/* clear display content before proceeding */
calc.ptr = calc.buffer;
@@ -949,13 +942,13 @@ static INT_PTR CALLBACK DlgStatProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
if (n == LB_ERR)
return TRUE;
SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_DELETESTRING, (WPARAM)n, 0);
update_n_stats_items(hWnd, buffer, sizeof(buffer));
update_n_stats_items(hWnd, buffer);
delete_stat_item(n);
return TRUE;
case IDC_BUTTON_CAD:
SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_RESETCONTENT, 0, 0);
clean_stat_list();
update_n_stats_items(hWnd, buffer, sizeof(buffer));
update_n_stats_items(hWnd, buffer);
return TRUE;
}
break;
@@ -971,7 +964,7 @@ static INT_PTR CALLBACK DlgStatProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
buffer, SIZEOF(buffer),
((statistic_t *)lp)->base);
SendDlgItemMessage(hWnd, IDC_LIST_STAT, LB_ADDSTRING, 0, (LPARAM)buffer);
update_n_stats_items(hWnd, buffer, sizeof(buffer));
update_n_stats_items(hWnd, buffer);
return TRUE;
}
return FALSE;
@@ -993,13 +986,11 @@ static void CopyMemToClipboard(void *ptr)
if(OpenClipboard(NULL)) {
HGLOBAL clipbuffer;
TCHAR *buffer;
size_t cbBuffer;
EmptyClipboard();
cbBuffer = (_tcslen(ptr) + 1) * sizeof(TCHAR);
clipbuffer = GlobalAlloc(GMEM_DDESHARE, cbBuffer);
clipbuffer = GlobalAlloc(GMEM_DDESHARE, (_tcslen(ptr)+1)*sizeof(TCHAR));
buffer = (TCHAR *)GlobalLock(clipbuffer);
StringCbCopy(buffer, cbBuffer, ptr);
_tcscpy(buffer, ptr);
GlobalUnlock(clipbuffer);
#ifdef UNICODE
SetClipboardData(CF_UNICODETEXT,clipbuffer);
@@ -1065,8 +1056,9 @@ static char *handle_sequence_input(HWND hwnd, sequence_t *seq)
}
} else
if (ch == '$') {
StringCbCopyEx(calc.buffer, sizeof(calc.buffer), calc.source, &calc.ptr, NULL,
STRSAFE_FILL_ON_FAILURE);
calc.ptr =
_tcscpy(calc.buffer, calc.source) +
_tcslen(calc.source);
} else {
for (x=0; x<SIZEOF(key2code); x++) {
if (!(key2code[x].mask & BITMASK_IS_ASCII) ||

View File

@@ -54,5 +54,5 @@ BEGIN
IDS_ABOUT "&О программе..."
IDS_TITLE "Таблица символов"
IDS_UNICODE "Unicode"
IDS_ALL "Все"
IDS_ALL "All"
END

View File

@@ -1,11 +1,4 @@
/*
* PROJECT: ReactOS Clipboard
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
ID_ACCEL ACCELERATORS
@@ -18,7 +11,7 @@ BEGIN
POPUP "&Fișier"
BEGIN
MENUITEM "&Deschidere…", CMD_OPEN
MENUITEM "S&alvează ca…", CMD_SAVE_AS
MENUITEM "Păst&rare ca…", CMD_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "I&eșire", CMD_EXIT
END

View File

@@ -31,7 +31,7 @@ id Порядковый номер запланированно
IDS_CONFIRM_YES "Y"
IDS_CONFIRM_NO "N"
IDS_DELETE_ALL "Эта операция удалит все запланированные задачи.\n"
IDS_DELETE_ALL "This operation will delete all scheduled jobs.\n"
IDS_NEW_JOB "Добавлено новое задание с ID = %lu\n"
IDS_JOBS_LIST "Статус ID День Время Команда\n"
IDS_NO_ENTRIES "В списке нет запланированных задач.\n"

View File

@@ -3,7 +3,6 @@
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2014 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -24,6 +23,6 @@ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] fișier ...\n\
Tastați ATTRIB fără argumente pentru afișarea atributelor pentru\n\
toate fișierele.\n"
STRING_CONSOLE_ERROR "Eroare necunoscută: %d\n"
STRING_FILE_NOT_FOUND "Fișierul nu a fost găsit - '%s'\n"
STRING_FILE_NOT_FOUND "File not found - '%s'\n"
STRING_ERROR_INVALID_PARAM_FORMAT "Formatul argumentului este eronat - %s\n"
END

View File

@@ -26,6 +26,6 @@ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] файл ...\n\
/D Обработка и файлов, и папок.\n\n\
Команда ATTRIB без параметров выводит атрибуты всех файлов.\n"
STRING_CONSOLE_ERROR "Неизвестная ошибка: %d\n"
STRING_FILE_NOT_FOUND "Файл не найден - '%s'\n"
STRING_FILE_NOT_FOUND "File not found - '%s'\n"
STRING_ERROR_INVALID_PARAM_FORMAT "Неверный формат параметра - %s\n"
END

View File

@@ -9,7 +9,7 @@ COMP [/L] [/A] [данные1] [данные2]\n\n\
/A Вывод различий в формате ASCII (по умолчанию: шестнадцатиричный).\n\
/L Вывод номеров строк, в которых обнаружены различия.\n"
IDS_INVALIDSWITCH "Недопустимый ключ - /%c\n"
IDS_BADSYNTAX "Неверный формат командной строки\n"
IDS_BADSYNTAX "Не верный формат командной строки\n"
IDS_FILEERROR "Не удалось найти/открыть файл: %s\n"
IDS_COMPARING "Сравнение %s и %s...\n"
IDS_FILESIZEERROR "Не удалось определить размер файла: %s\n"

View File

@@ -30,9 +30,9 @@ FC /B [диск1:][путь1]имя_файла1 [диск2:][путь2]имя_ф
IDS_LONGER_THAN "FC: %ls длиннее, чем %ls\n"
IDS_COMPARING "Сравнение файлов %ls и %ls\n"
IDS_OUT_OF_MEMORY "FC: Недостаточно памяти\n"
IDS_CANNOT_READ "FC: Не удаётся прочитать %ls\n"
IDS_CANNOT_READ "FC: не удаётся прочитать %ls\n"
IDS_INVALID_SWITCH "FC: Недопустимый ключ\n"
IDS_CANNOT_OPEN "FC: Не удаётся открыть %ls - файл либо папка не существует\n"
IDS_CANNOT_OPEN "FC: не удаётся открыть %ls - файл либо папка не существует\n"
IDS_NEEDS_FILES "FC: Недостаточное количество имён файлов\n"
IDS_CANT_USE_WILDCARD "Подстановочные знаки ('*' и '?') пока не поддерживаются\n"
IDS_DIFFERENT "FC: Файлы %ls и %ls различны\n"

View File

@@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Find Command
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
* FILE: base/applications/cmdutils/find/lang/ro-RO.rc
* ReactOS Project (https://reactos.org)
* TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan)
* CHANGE LOG: 2011-08-20 initial translation
* 2011-10-17 diacritics change, other minor changes
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -16,9 +16,8 @@ FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] ""șir"" [fișier...]\n\
/C Numără liniile ce conțin șirul.\n\
/N Numără rândurile afișate, începând cu 1.\n\
/I Ignoră diferențele între majuscule și minuscule.\n\
/OFF[LINE] Nu omite fișierele care au configurate atributul\n\
offline (deconectat)."
/OFF[LINE] Do not skip files that have the offline attribute set."
IDS_NO_SUCH_FILE "FIND: Fișierul «%s» nu există!\n"
IDS_CANNOT_OPEN "FIND: Fișierul «%s» nu poate fi deschis!\n"
IDS_INVALID_SWITCH "FIND: Comutare nevalidă\n"
IDS_INVALID_SWITCH "FIND: Invalid switch\n"
END

View File

@@ -8,11 +8,11 @@ FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] ""строка"" [[диск:][путь]и
/C Вывод только общего числа строк, содержащих заданную строку.\n\
/N Вывод номеров отображаемых строк.\n\
/I Поиск без учета регистра символов.\n\
/OFF[LINE] Не пропускать файлы, у которых установлен атрибут offline.\n\
/OFF[LINE] Do not skip files that have the offline attribute set.\n\
""строка"" Искомая строка.\n\
[диск:][путь]имя_файла\n\
Один или несколько файлов, в которых выполняется поиск."
IDS_NO_SUCH_FILE "FIND: %s: Файл не существует.\n"
IDS_CANNOT_OPEN "FIND: %s: Невозможно открыть файл.\n"
IDS_INVALID_SWITCH "FIND: Недопустимый ключ\n"
IDS_INVALID_SWITCH "FIND: Invalid switch\n"
END

View File

@@ -1,26 +1,20 @@
/*
* PROJECT: ReactOS Label Command
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
// STRING_LABEL_HELP "Afișează sau modifică eticheta unei unități (de stocare).\n\nLABEL [unitate:][etichetă]\n"
STRING_LABEL_HELP "Crea, schimbă sau șterge denumirea unui dispozitiv.\n\n\
LABEL [dispozitiv:][denumire]\n\n\
dispozitiv: Specifică litera unui dispozitiv.\n\
denumire Specifică denumirea unui dispozitiv."
STRING_LABEL_TEXT1 "Volumul unității %c: este denumit ca %s\n"
STRING_LABEL_TEXT2 "Volumul unității %c: nu este denumit.\n"
STRING_LABEL_HELP "Creates, changes or deletes the volume label of a disk.\n\n\
LABEL [drive:][label]\n\n\
drive: Specifies the drive letter of a drive.\n\
label Specifies the label of the drive."
STRING_LABEL_TEXT1 "Volumul unității %c: este etichetat ca %s\n"
STRING_LABEL_TEXT2 "Volumul unității %c: nu este etichetat.\n"
STRING_LABEL_TEXT3 "Numărul de serie al volumului este %04X-%04X\n"
STRING_LABEL_TEXT4 "Introduceți denumirea unității (opțională, de 32 caractere), apoi ENTER "
STRING_LABEL_PROMPT "Ștergeți denumirea actuală a volumului (Da/Nu)? "
STRING_LABEL_OPTIONS "DaNu"
STRING_LABEL_TEXT4 "Introduceți eticheta unității (opțională, de 32 caractere), apoi ENTER "
STRING_LABEL_PROMPT "Delete current volume label (Y/N)? "
STRING_LABEL_OPTIONS "YN"
STRING_ERROR_INVALID_DRIVE "Specificarea unității este eronată\n"
STRING_ERROR_INVALID_LABEL "Denumirea volumului e nevalidă\n"
STRING_ERROR_INVALID_LABEL "Invalid volume label\n"
END

View File

@@ -1,65 +1,60 @@
/*
* PROJECT: ReactOS More Command
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
* FILE: base/applications/cmdutils/more/lang/ro-RO.rc
* ReactOS Project (https://reactos.org)
* TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan)
* CHANGE LOG: 2011-08-20 initial translation
* 2011-10-17 diacritics change, other minor changes
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_USAGE "Afișarea datelor pe ecran, pagină cu pagină.\n\
IDS_USAGE "Afișea date pe ecran, pagină-cu-pagină.\n\
\n\
MORE [/E [opțiuni]] < [dispozitiv:][cale]numele fișierului\n\
command | MORE [/E [opțiuni]\n\
MORE [/E [options]] < [drive:][path]filename\n\
command | MORE [/E [options]]\n\
\n\
[dispozitiv:][cale]numele fișierului Un fișier al cărui conținut\n\
urmează să fie afișat.\n\
comandă O comandă a cărei ieșire\n\
urmează să fie afișată.\n\
[drive:][path]filename A file whose contents are to be displayed.\n\
command A command whose output is to be displayed.\n\
\n\
Atunci când opțiunea Caracteristici extinse e activată,\n\
următoarea formă este acceptată:\n\
MORE [/E] [opțiuni] [fișiere]\n\
When Extended Features are enabled, the following form is supported:\n\
MORE [/E] [options] [files]\n\
\n\
Opțiuni:\n\
/E Activarea opțiunii Caracteristici extinse.\n\
Stadiul implicit al Caracteristicilor extinse e controlat de setările\n\
implicite de registru pentru programul CMD.EXE. Pentru mai multe detalii\n\
legate de cum pot fi schimbate aceste setări, vedeți secțiunea\n\
""Extensii de comenzi"" în secțiunea de ajutor a programului CMD.EXE.\n\
Options:\n\
/E Enable Extended Features.\n\
The default state of the Extended Features is controlled by the default\n\
registry settings for CMD.EXE. For more details on how to change these\n\
settings, see the section ""Command Extensions"" in CMD.EXE help.\n\
\n\
Atunci când opțiunea Caracteristici extinse e activată, sunt disponibile\n\
următoarele opțiuni:\n\
/C Curățarea ecranului înainte de a se afișa o pagină.\n\
/P Extinderea caracterelor Form-Feed (de alimentare de formulare).\n\
/S Reducerea liniilor goale succesive la o singură linie.\n\
/Tn Extinderea tab-urilor la n spații (implicit: 8).\n\
When Extended Features are enabled, the following options are available:\n\
/C Clear the screen before displaying a page.\n\
/P Expand Form-Feed characters.\n\
/S Shrink successive blank lines to a single line.\n\
/Tn Expand tabs to n spaces (default: 8).\n\
\n\
Aceste opțiuni pot fi specificate în variabila de mediu MORE.\n\
These options can be specified in the MORE environment variable.\n\
\n\
+n Începerea afișării primului fișier la linia n.\n\
fișiere Lista fișierelor de afișat, separate prin spații libere.\n\
+n Start displaying the first file at line n.\n\
files List of files to display, separated by blanks.\n\
\n\
Atunci când opțiunea Caracteristici extinse e activată, sunt disponibile\n\
următoarele comenzi la panoul ""-- Continuă --"":\n\
When Extended Features are enabled, the following commands are available\n\
at the ""-- Continue --"" prompt:\n\
\n\
P n Afișarea următoarelor n linii.\n\
S n Omiterea următoarelor n linii.\n\
F Afișarea următorului fișier.\n\
Q Ieșire.\n\
= Afișarea numărului de linie.\n\
? Afișarea liniei de ajutor.\n\
<Space> Afișarea următoarei pagini.\n\
<Enter> Afișarea următoari linii.\n"
P n Display the next n lines.\n\
S n Skip the next n lines.\n\
F Display the next file.\n\
Q Quit.\n\
= Show the line number.\n\
? Show the help line.\n\
<Space> Display the next page.\n\
<Enter> Display the next line.\n"
IDS_BAD_FLAG "Argument nevalid - '%s'\n"
IDS_BAD_FLAG "Invalid argument - '%s'\n"
IDS_FILE_ACCESS "Fișierul «%s» nu poate fi accesat!\n"
IDS_CONTINUE_PROMPT "-- Continuă%1%2%3 --%4"
IDS_CONTINUE_PERCENT " (%d%%)"
IDS_CONTINUE_LINE_AT " [Linie: %d]"
IDS_CONTINUE_OPTIONS " [Opțiuni: psfq=<Space><Enter>]"
IDS_CONTINUE_LINES " Linii: "
IDS_CONTINUE_LINE_AT " [Line: %d]"
IDS_CONTINUE_OPTIONS " [Options: psfq=<Space><Enter>]"
IDS_CONTINUE_LINES " Lines: "
END

View File

@@ -1,10 +1,4 @@
/*
* PROJECT: ReactOS Taskkill Command
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -24,6 +18,6 @@ STRINGTABLE
STRING_ENUM_FAILED, "Eroare: Procesele nu au putut fi enumerate.\n"
STRING_TERMINATE_FAILED, "Eroare: Procesul «%1» nu poate fi oprit.\n"
STRING_SELF_TERMINATION, "Eroare: Auto-terminarea nu este permisă.\n"
STRING_PARAM_TOO_MUCH, "Eroare: Sintaxă nevalidă. Opțiunea '%1' nu este permisă mai mult de '%2!d!' dată(dăți).\n"
STRING_INVALID_SYNTAX, "Eroare: Sintaxă nevalidă.\n"
STRING_PARAM_TOO_MUCH, "Error: Invalid syntax. '%1' option is not allowed more than '%2!d!' time(s).\n"
STRING_INVALID_SYNTAX, "Error: Invalid syntax.\n"
}

View File

@@ -52,7 +52,7 @@ XCOPY источник [целевой_объект] [/I] [/S] [/Q] [/F] [/L] [/
/A Копирует только те файлы, для которых установлен атрибут ""архивный"".\n\
/M Копирует только те файлы, для которых установлен атрибут ""архивный"",\n\
при этом атрибут удаляется.\n\
[/K] Копирует атрибуты файлов, без этого атрибуты не сохраняются.\n\
[/K] Copy file attributes, without this attributes are not preserved.\n\
/D | /D:m-d-y Копирование файлов, измененных не ранее указанной даты.\n\
Если дата не указана, заменяются только конечные файлы,\n\
более старые, чем исходные.\n"

View File

@@ -1,9 +1,7 @@
/*
* PROJECT: ReactOS DX Diagnostic
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
* FILE: base/applications/dxdiag/lang/ro-RO.rc
* ReactOS Project (https://reactos.org)
* TRANSLATOR: Ștefan Fulea (stefan dot fulea at mail dot com)
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -17,7 +15,7 @@ BEGIN
CONTROL "Tab1", IDC_TAB_CONTROL, "SysTabControl32", WS_TABSTOP, 2, 2, 474, 250
PUSHBUTTON "&Manual…", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
DEFPUSHBUTTON "&Următorul compartiment", IDC_BUTTON_NEXT, 187, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "S&alvare informații…", IDC_BUTTON_SAVE_INFO, 311, 260, 110, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
PUSHBUTTON "&Păstrare informații…", IDC_BUTTON_SAVE_INFO, 311, 260, 110, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED
PUSHBUTTON "Î&nchide", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
@@ -25,7 +23,7 @@ IDD_SYSTEM_DIALOG DIALOGEX 0, 0, 462, 220
STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Acest instrument oferă informații detaliate despre componentele ReactX și drivere instalate în sistem.", IDC_STATIC, 5, 0, 443, 17
LTEXT "Acest instrument oferă informații detaliate despre componentele ReactX și modulele-pilot instalate în sistem.", IDC_STATIC, 5, 0, 443, 17
LTEXT "Dacă aveți la cunoștință careva probleme la o anumită categorie, mergeți la compartimentul corespunzător de mai sus. Altfel, puteți utiliza butonul „Următorul compartiment” de mai jos pentru a trece secvențial prin fiecare categorie.", IDC_STATIC, 5, 15, 443, 25
GROUPBOX "Informații despre sistem", IDC_STATIC, 5, 35, 452, 150, SS_RIGHT
LTEXT "Data/Ora curentă:", IDC_STATIC, 70, 50, 80, 10, SS_RIGHT

View File

@@ -1,23 +1,17 @@
/*
* PROJECT: ReactOS fltmc utility
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
/* Translator: Ștefan Fulea (stefan dot fulea at mail dot com) */
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_USAGE "\nComenzi valide:\n\
load Încarcă un driver de tip filtru\n\
unload Descarcă un driver de tip filtru\n\
load Încarcă un modul-pilot de tip filtru\n\
unload Descarcă un modul-pilot de tip filtru\n\
filters Afișează filtrele înregistrate acum în sistem\n\n\
volumes Afișează toate volumele\n\n"
IDS_USAGE_LOAD "Încarcă un driver de tip filtru\n"
IDS_USAGE_UNLOAD "Descarcă un driver de tip filtru\n"
IDS_USAGE_LOAD "Încarcă un modul-pilot de tip filtru\n"
IDS_USAGE_UNLOAD "Descarcă un modul-pilot de tip filtru\n"
IDS_USAGE_FILTERS "Afișează toate filtrele înregistrate\n"
IDS_USAGE_VOLUMES "Afișează toate volumele\n"
END
@@ -31,7 +25,7 @@ END
STRINGTABLE
BEGIN
IDS_ERROR_PRIV "Eșec la instituirea dreptului de încărcare pentru driverul (0x%X)\n"
IDS_ERROR_PRIV "Eșec la instituirea dreptului de încărcare pentru modulul-pilot (0x%X)\n"
IDS_ERROR_FILTERS "Eșec la afișarea filtrelor (0x%X)\n"
IDS_ERROR_LOAD "Eșec la încărcarea filtrului (0x%X)\n"
IDS_ERROR_UNLOAD "Eșec la descărcarea filtrului (0x%X)\n"

View File

@@ -11,7 +11,7 @@ BEGIN
IDS_USAGE_LOAD "Загружает драйвер фильтра\n"
IDS_USAGE_UNLOAD "Выгружает драйвер фильтра\n"
IDS_USAGE_FILTERS "Выводит список всех зарегистрированных фильтров\n"
IDS_USAGE_VOLUMES "Выводит список всех томов\n"
IDS_USAGE_VOLUMES "Lists all volumes\n"
END
STRINGTABLE
@@ -27,5 +27,5 @@ BEGIN
IDS_ERROR_FILTERS "Не удалось получить список фильтров (0x%X)\n"
IDS_ERROR_LOAD "Не удалось загрузить фильтр (0x%X)\n"
IDS_ERROR_UNLOAD "Не удалось выгрузить фильтр (0x%X)\n"
IDS_ERROR_VOLUMES "Не удалось получить список томов (0x%X)\n"
IDS_ERROR_VOLUMES "Failed to list the volumes (0x%X)\n"
END

View File

@@ -4,7 +4,7 @@
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2009 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2018 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2022-2023 Andrei Miloiu <miloiuandrei@gmail.com>
* Copyright 2022 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -25,7 +25,7 @@ BEGIN
AUTORADIOBUTTON "Fă&ră", IDC_OPT_NOSCORE, 107, 45, 60, 10
AUTOCHECKBOX "&Afișează timp", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP
AUTOCHECKBOX "&Bară de stare", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP
AUTOCHECKBOX "Salvea&ză scorul", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP
AUTOCHECKBOX "&Păstrează scorul", IDC_OPT_KEEPSCORE, 100, 66, 65, 10, WS_TABSTOP
DEFPUSHBUTTON "Con&firmă", IDOK, 35, 97, 50, 14
PUSHBUTTON "A&nulează", IDCANCEL, 101, 97, 50, 14
END

View File

@@ -145,9 +145,16 @@ static VOID UpdateLayoutList(HKL hKL OPTIONAL)
if (!hKL)
{
HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow());
DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
hKL = GetKeyboardLayout(dwTID);
if (0 <= (g_nCurrentLayoutNum - 1) && (g_nCurrentLayoutNum - 1) < g_cKLs)
{
hKL = g_ahKLs[g_nCurrentLayoutNum - 1];
}
else
{
HWND hwndTarget = (g_hwndLastActive ? g_hwndLastActive : GetForegroundWindow());
DWORD dwTID = GetWindowThreadProcessId(hwndTarget, NULL);
hKL = GetKeyboardLayout(dwTID);
}
}
g_cKLs = GetKeyboardLayoutList(ARRAYSIZE(g_ahKLs), g_ahKLs);
@@ -730,8 +737,6 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONUP:
case WM_LBUTTONUP:
{
UpdateLayoutList(NULL);
GetCursorPos(&pt);
SetForegroundWindow(hwnd);

View File

@@ -1,10 +1,6 @@
/*
* PROJECT: ReactOS Magnifier
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
* Translators: Petru Dimitriu (petrimetri at gmail dot com)
* Ștefan Fulea (stefan dot fulea at mail dot com)
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -39,7 +35,7 @@ END
IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Setările lupei"
CAPTION "Configurare lupă"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Î&nchide", IDOK, 96, 161, 50, 14

View File

@@ -28,8 +28,8 @@ BEGIN
BEGIN
MENUITEM "&Nou\tCtrl+N", IDM_FILE_NEW
MENUITEM "&Deschide\tCtrl+O", IDM_FILE_OPEN
MENUITEM "S&alvează", IDM_FILE_SAVE
MENUITEM "Sal&vează ca…", IDM_FILE_SAVEAS
MENUITEM "&Păstrează", IDM_FILE_SAVE
MENUITEM "Păst&rare în…", IDM_FILE_SAVEAS
MENUITEM SEPARATOR
MENUITEM "I&eșire\tAlt+F4", IDM_FILE_EXIT
END

View File

@@ -1,10 +1,4 @@
/*
* PROJECT: ReactOS System Configuration Tool
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
/* Ștefan Fulea (stefan dot fulea at mail dot com) */
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -74,8 +68,8 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "Moduri de pornire sistem", -1, 10, 10, 340, 150, 0, WS_EX_TRANSPARENT
CONTROL "Pornire n&ormală - încarcă toate serviciile și driverele", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 260, 10
CONTROL "Pornire de &diagnostic - încarcă doar driverele de bază", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 260, 10
CONTROL "Pornire n&ormală - încarcă toate serviciile și modulele-pilot", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 260, 10
CONTROL "Pornire de &diagnostic - încarcă doar modulele-pilot de bază", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 260, 10
CONTROL "Pornire s&electivă", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 260, 10
AUTOCHECKBOX "&Procesează fișierul SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 260, 10
AUTOCHECKBOX "Încarcă se&rviciile de sistem", IDC_CBX_SYSTEM_SERVICE, 30, 95, 260, 10

View File

@@ -1,10 +1,4 @@
/*
* PROJECT: ReactOS System Configuration Tool
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
/* Ștefan Fulea (stefan dot fulea at mail dot com) */
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -16,7 +10,7 @@ BEGIN
ICON IDI_APPICON, IDC_STATIC, 14, 14, 20, 20
LTEXT "Program de configurare al sistemului\nVersiune 1.0", IDC_STATIC, 42, 14, 182, 17, SS_NOPREFIX
// "Copyright (C) ReactOS Team 2005-"COPYRIGHT_YEAR"\n"
LTEXT "Drept de autor (C) Echipa ReactOS 2005-2023\n\
LTEXT "Drept de autor (C) Echipa ReactOS 2005-2015\n\
Christoph von Wittich (Christoph@ApiViewer.de)\n\
Gregor Schneider (Gregor.Schneider@reactos.org)\n\
Hermès BÉLUSCA - MAÏTO (hermes.belusca@sfr.fr)",
@@ -40,8 +34,8 @@ BEGIN
PUSHBUTTON "Lansează &Restaurare sistem", IDC_BTN_SYSTEM_RESTORE_START, 146, 156, 124, 14
PUSHBUTTON "E&xtindere fișier…", IDC_BTN_FILE_EXTRACTION, 275, 156, 85, 14
GROUPBOX "Moduri de pornire sistem", IDC_STATIC, 5, 5, 356, 145
LTEXT "Încarcă toate serviciile și driverele", IDC_STATIC, 25, 30, 322, 10
LTEXT "Încarcă doar driverele de bază", IDC_STATIC, 25, 58, 322, 10
LTEXT "Încarcă toate serviciile și modulele-pilot", IDC_STATIC, 25, 30, 322, 10
LTEXT "Încarcă doar modulele-pilot de bază", IDC_STATIC, 25, 58, 322, 10
END
IDD_SYSTEM_PAGE DIALOGEX 0, 0, 366, 175

View File

@@ -4,7 +4,6 @@
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2009 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2018 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -14,12 +13,12 @@ BEGIN
POPUP "&Jurnal"
BEGIN
MENUITEM "&Deschidere…", IDM_OPEN_EVENTLOG
MENUITEM "&Salvează jurnal de evenimente ca…", IDM_SAVE_EVENTLOG
MENUITEM "&Păstrare jurnal de evenimente ca…", IDM_SAVE_EVENTLOG
MENUITEM "Î&nchide", IDM_CLOSE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "Înlăt&ură toate evenimentele", IDM_CLEAR_EVENTS
MENUITEM "&Redenumire\tF2", IDM_RENAME_EVENTLOG
MENUITEM "&Setări pentru jurnal…", IDM_EVENTLOG_SETTINGS
MENUITEM "&Configurare jurnal…", IDM_EVENTLOG_SETTINGS
MENUITEM SEPARATOR
MENUITEM "I&eșire", IDM_EXIT
END
@@ -37,7 +36,7 @@ BEGIN
MENUITEM "Afișează detalii de e&venimente", IDM_EVENT_DETAILS_VIEW
MENUITEM "Afișează linii de g&rilaj", IDM_LIST_GRID_LINES
MENUITEM SEPARATOR
MENUITEM "&Salvează setările la ieșire", IDM_SAVE_SETTINGS
MENUITEM "&Păstrează configurația la ieșire", IDM_SAVE_SETTINGS
END
POPUP "Aj&utor"
BEGIN
@@ -51,12 +50,12 @@ IDM_EVENTWR_CTX MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "&Deschide jurnalul de evenimente...", IDM_OPEN_EVENTLOG
MENUITEM "Salv&ează jurnalul de evenimente ca...", IDM_SAVE_EVENTLOG
MENUITEM "&Open Event Log...", IDM_OPEN_EVENTLOG
MENUITEM "&Save Event Log as...", IDM_SAVE_EVENTLOG
MENUITEM SEPARATOR
MENUITEM "Șter&ge toate evenimentele", IDM_CLEAR_EVENTS
MENUITEM "&Redenumește\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Setări de &jurnal...", IDM_EVENTLOG_SETTINGS
MENUITEM "&Clear all Events", IDM_CLEAR_EVENTS
MENUITEM "&Rename\tF2", IDM_RENAME_EVENTLOG
MENUITEM "Log Se&ttings...", IDM_EVENTLOG_SETTINGS
END
END
@@ -130,7 +129,7 @@ BEGIN
EDITTEXT IDC_CREATED_LABEL, 67, 69, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL
LTEXT "Modificat:", IDC_STATIC, 7, 81, 60, 8
EDITTEXT IDC_MODIFIED_LABEL, 67, 81, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL
LTEXT "Accesat:", IDC_STATIC, 7, 93, 60, 8
LTEXT "Accessat:", IDC_STATIC, 7, 93, 60, 8
EDITTEXT IDC_ACCESSED_LABEL, 67, 93, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL
GROUPBOX "Dimensiune jurnal", IDC_STATIC, 7, 106, 238, 99
LTEXT "Dimensiune ma&ximă pentru jurnal:", IDC_STATIC, 17, 122, 58, 8
@@ -164,7 +163,7 @@ BEGIN
IDS_EVENTLOG_USER "Jurnale de utilizator"
IDS_SAVE_FILTER "Jurnal de evenimente (*.evt)\0*.evt\0"
IDS_CLEAREVENTS_MSG "Doriți păstrarea acestui jurnal de evenimente înainte de a-l închide?"
IDS_RESTOREDEFAULTS "Doriți să restaurați toate setările pentru acest jurnal la valorile lor implicite?"
IDS_RESTOREDEFAULTS "Do you want to restore all settings for this log to their default values?"
IDS_EVENTSTRINGIDNOTFOUND "Descrierea evenimentului cu ID-ul ( %lu ) în sursa ( %s ) nu a fost găsită. Este posibil ca în calculatorul local să nu existe informațiile de registru necesare sau fișierele dll de mesaje să afișeze mesaje de la un calculator din rețea.\n\nInformații aferente evenimentului:\n\n"
END

View File

@@ -1,10 +1,6 @@
/*
* PROJECT: ReactOS Service Manager
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Romanian resource file
* TRANSLATORS: Copyright 2011 Petru Dimitriu <petrimetri@gmail.com>
* Copyright 2011-2019 Ștefan Fulea <stefan.fulea@mail.com>
* Copyright 2023 Andrei Miloiu <miloiuandrei@gmail.com>
* Translators: Petru Dimitriu (petrimetri at gmail dot com)
* Ștefan Fulea (stefan dot fulea at mail dot com)
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@@ -137,7 +133,7 @@ BEGIN
COMBOBOX IDC_SECOND_FAILURE, 104, 39, 141, 147, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST
LTEXT "Alt&e căderi:", IDC_STATIC, 7, 58, 92, 8
COMBOBOX IDC_SUBSEQUENT_FAILURES, 104, 56, 141, 147, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST
LTEXT "&Repornire contor după:", IDC_STATIC, 7, 75, 72, 8
LTEXT "&Ropornire contor după:", IDC_STATIC, 7, 75, 72, 8
EDITTEXT IDC_RESET_TIME, 104, 73, 40, 13, WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER
LTEXT "zile", IDC_STATIC, 150, 75, 95, 8
LTEXT "Repornire ser&viciu după:", IDC_RESTART_TEXT1, 7, 92, 92, 8
@@ -336,7 +332,7 @@ BEGIN
IDS_NO_ACTION "Nici o acțiune"
IDS_RESTART_SERVICE "Repornește serviciul"
IDS_RUN_PROGRAM "Execută un program"
IDS_RESTART_COMPUTER "Repornește calculatorul"
IDS_RESTART_COMPUTER "Ropornește calculatorul"
END
STRINGTABLE

View File

@@ -28,7 +28,7 @@ list(APPEND SOURCE
winproc.cpp
precomp.h)
file(GLOB mspaint_rc_deps img/*.*)
file(GLOB mspaint_rc_deps icons/*.*)
add_rc_deps(rsrc.rc ${mspaint_rc_deps})
add_executable(mspaint ${SOURCE} rsrc.rc)
set_module_type(mspaint win32gui UNICODE)

View File

@@ -69,7 +69,7 @@ public:
return TRUE;
}
HRESULT LoadDx(LPCWSTR pszFileName, float *pxDpi, float *pyDpi) throw()
HRESULT LoadDx(LPCTSTR pszFileName, float *pxDpi, float *pyDpi) throw()
{
using namespace Gdiplus;
@@ -111,7 +111,7 @@ public:
return (status == Ok ? S_OK : E_FAIL);
}
HRESULT SaveDx(LPCWSTR pszFileName, REFGUID guidFileType = GUID_NULL,
HRESULT SaveDx(LPCTSTR pszFileName, REFGUID guidFileType = GUID_NULL,
float xDpi = 0, float yDpi = 0) throw()
{
using namespace Gdiplus;
@@ -141,7 +141,7 @@ public:
CLSID clsid;
if (::IsEqualGUID(guidFileType, GUID_NULL))
{
CStringW strExt(PathFindExtensionW(pszFileName));
CString strExt(PathFindExtension(pszFileName));
clsid = FindCodecForExtension(strExt, pEncoders, cEncoders);
}
else
@@ -300,23 +300,23 @@ protected:
// CImage::FindCodecForExtension is private. We have to duplicate it at here...
static CLSID
FindCodecForExtension(LPCWSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs)
FindCodecForExtension(LPCTSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs)
{
for (UINT i = 0; i < nCodecs; ++i)
{
CStringW strSpecs(pCodecs[i].FilenameExtension);
CString strSpecs(pCodecs[i].FilenameExtension);
int ichOld = 0, ichSep;
for (;;)
{
ichSep = strSpecs.Find(L';', ichOld);
ichSep = strSpecs.Find(TEXT(';'), ichOld);
CStringW strSpec;
CString strSpec;
if (ichSep < 0)
strSpec = strSpecs.Mid(ichOld);
else
strSpec = strSpecs.Mid(ichOld, ichSep - ichOld);
int ichDot = strSpec.ReverseFind(L'.');
int ichDot = strSpec.ReverseFind(TEXT('.'));
if (ichDot >= 0)
strSpec = strSpec.Mid(ichDot);

View File

@@ -29,6 +29,18 @@ CCanvasWindow::~CCanvasWindow()
::DeleteObject(m_ahbmCached[1]);
}
VOID CCanvasWindow::drawZoomFrame(INT mouseX, INT mouseY)
{
// FIXME: Draw the border of the area that is to be zoomed in
CRect rc;
GetImageRect(rc);
ImageToCanvas(rc);
HDC hdc = GetDC();
DrawXorRect(hdc, &rc);
ReleaseDC(hdc);
}
RECT CCanvasWindow::GetBaseRect()
{
CRect rcBase;
@@ -89,88 +101,31 @@ HITTEST CCanvasWindow::CanvasHitTest(POINT pt)
return getSizeBoxHitTest(pt, &rcBase);
}
VOID CCanvasWindow::getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget)
{
CRect rcImage;
GetImageRect(rcImage);
ImageToCanvas(rcImage);
// Calculate the zoom rectangle
INT oldZoom = toolsModel.GetZoom();
GetClientRect(rcView);
LONG cxView = rcView.right * oldZoom / newZoom, cyView = rcView.bottom * oldZoom / newZoom;
::SetRect(&rcView, ptTarget.x - cxView / 2, ptTarget.y - cyView / 2,
ptTarget.x + cxView / 2, ptTarget.y + cyView / 2);
// Shift the rectangle if necessary
INT dx = 0, dy = 0;
if (rcView.left < rcImage.left)
dx = rcImage.left - rcView.left;
else if (rcImage.right < rcView.right)
dx = rcImage.right - rcView.right;
if (rcView.top < rcImage.top)
dy = rcImage.top - rcView.top;
else if (rcImage.bottom < rcView.bottom)
dy = rcImage.bottom - rcView.bottom;
rcView.OffsetRect(dx, dy);
rcView.IntersectRect(&rcView, &rcImage);
}
VOID CCanvasWindow::zoomTo(INT newZoom, LONG left, LONG top)
{
POINT pt = { left, top };
CanvasToImage(pt);
toolsModel.SetZoom(newZoom);
ImageToCanvas(pt);
pt.x += GetScrollPos(SB_HORZ);
pt.y += GetScrollPos(SB_VERT);
updateScrollRange();
updateScrollPos(pt.x, pt.y);
Invalidate(TRUE);
}
VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
{
// This is the target area we have to draw on
CRect rcCanvasDraw;
rcCanvasDraw.IntersectRect(&rcClient, &rcPaint);
// We use a memory bitmap to reduce flickering
HDC hdcMem0 = ::CreateCompatibleDC(hDC);
m_ahbmCached[0] = CachedBufferDIB(m_ahbmCached[0], rcClient.right, rcClient.bottom);
HGDIOBJ hbm0Old = ::SelectObject(hdcMem0, m_ahbmCached[0]);
// Fill the background on hdcMem0
::FillRect(hdcMem0, &rcCanvasDraw, (HBRUSH)(COLOR_APPWORKSPACE + 1));
::FillRect(hdcMem0, &rcPaint, (HBRUSH)(COLOR_APPWORKSPACE + 1));
// Draw the sizeboxes if necessary
RECT rcBase = GetBaseRect();
if (!selectionModel.m_bShow && !::IsWindowVisible(textEditWindow))
drawSizeBoxes(hdcMem0, &rcBase, FALSE, &rcCanvasDraw);
drawSizeBoxes(hdcMem0, &rcBase, FALSE, &rcPaint);
// Calculate image size
CRect rcImage;
GetImageRect(rcImage);
SIZE sizeImage = { imageModel.GetWidth(), imageModel.GetHeight() };
// Calculate the target area on the image
CRect rcImageDraw = rcCanvasDraw;
CanvasToImage(rcImageDraw);
rcImageDraw.IntersectRect(&rcImageDraw, &rcImage);
// Consider rounding down by zooming
rcImageDraw.right += 1;
rcImageDraw.bottom += 1;
// hdcMem1 <-- imageModel
HDC hdcMem1 = ::CreateCompatibleDC(hDC);
m_ahbmCached[1] = CachedBufferDIB(m_ahbmCached[1], sizeImage.cx, sizeImage.cy);
HGDIOBJ hbm1Old = ::SelectObject(hdcMem1, m_ahbmCached[1]);
::BitBlt(hdcMem1, rcImageDraw.left, rcImageDraw.top, rcImageDraw.Width(), rcImageDraw.Height(),
imageModel.GetDC(), rcImageDraw.left, rcImageDraw.top, SRCCOPY);
BitBlt(hdcMem1, 0, 0, sizeImage.cx, sizeImage.cy, imageModel.GetDC(), 0, 0, SRCCOPY);
// Draw overlay #1 on hdcMem1
toolsModel.OnDrawOverlayOnImage(hdcMem1);
@@ -215,15 +170,17 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
DrawXorRect(hdcMem0, &m_rcResizing);
// Transfer the bits (hDC <-- hdcMem0)
::BitBlt(hDC, rcCanvasDraw.left, rcCanvasDraw.top, rcCanvasDraw.Width(), rcCanvasDraw.Height(),
hdcMem0, rcCanvasDraw.left, rcCanvasDraw.top, SRCCOPY);
::BitBlt(hDC,
rcPaint.left, rcPaint.top,
rcPaint.right - rcPaint.left, rcPaint.bottom - rcPaint.top,
hdcMem0, rcPaint.left, rcPaint.top, SRCCOPY);
// Clean up hdcMem0
::SelectObject(hdcMem0, hbm0Old);
::DeleteDC(hdcMem0);
}
VOID CCanvasWindow::updateScrollRange()
VOID CCanvasWindow::Update(HWND hwndFrom)
{
CRect rcClient;
GetClientRect(&rcClient);
@@ -254,16 +211,10 @@ VOID CCanvasWindow::updateScrollRange()
SetScrollInfo(SB_VERT, &si);
}
VOID CCanvasWindow::updateScrollPos(INT x, INT y)
{
SetScrollPos(SB_HORZ, x);
SetScrollPos(SB_VERT, y);
}
LRESULT CCanvasWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (m_hWnd)
updateScrollRange();
Update(m_hWnd);
return 0;
}
@@ -278,7 +229,7 @@ VOID CCanvasWindow::OnHVScroll(WPARAM wParam, INT fnBar)
{
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
si.nPos = (SHORT)HIWORD(wParam);
si.nPos = HIWORD(wParam);
break;
case SB_LINELEFT:
si.nPos -= 5;
@@ -293,9 +244,9 @@ VOID CCanvasWindow::OnHVScroll(WPARAM wParam, INT fnBar)
si.nPos += si.nPage;
break;
}
si.nPos = max(min(si.nPos, si.nMax), si.nMin);
SetScrollInfo(fnBar, &si);
Invalidate();
Update(m_hWnd);
Invalidate(FALSE); // FIXME: Flicker
}
LRESULT CCanvasWindow::OnHScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -310,41 +261,21 @@ LRESULT CCanvasWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
return 0;
}
LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
m_nMouseDownMsg = nMsg;
BOOL bLeftButton = (nMsg == WM_LBUTTONDOWN);
if (nMsg == WM_MBUTTONDOWN)
{
m_ptOrig = pt;
SetCapture();
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG)));
return 0;
}
HITTEST hitSelection = SelectionHitTest(pt);
if (hitSelection != HIT_NONE)
{
selectionModel.m_nSelectionBrush = 0; // Selection Brush is OFF
if (bLeftButton)
{
CanvasToImage(pt);
if (::GetKeyState(VK_CONTROL) < 0) // Ctrl+Click is Selection Clone
{
imageModel.SelectionClone();
}
else if (::GetKeyState(VK_SHIFT) < 0) // Shift+Dragging is Selection Brush
{
selectionModel.m_nSelectionBrush = 1; // Selection Brush is ON
}
StartSelectionDrag(hitSelection, pt);
}
else
{
ClientToScreen(&pt);
canvasWindow.ClientToScreen(&pt);
mainWindow.TrackPopupMenu(pt, 0);
}
return 0;
@@ -357,14 +288,14 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
{
case TOOL_BEZIER:
case TOOL_SHAPE:
toolsModel.OnEndDraw(TRUE);
Invalidate();
toolsModel.OnCancelDraw();
canvasWindow.Invalidate();
break;
case TOOL_FREESEL:
case TOOL_RECTSEL:
toolsModel.OnEndDraw(FALSE);
Invalidate();
toolsModel.OnFinishDraw();
canvasWindow.Invalidate();
break;
default:
@@ -397,40 +328,45 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
return 0;
}
LRESULT CCanvasWindow::OnButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CCanvasWindow::OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDown(TRUE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDown(FALSE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnLRButtonDblClk(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
CanvasToImage(pt);
m_drawing = FALSE;
::ReleaseCapture();
m_nMouseDownMsg = 0;
ReleaseCapture();
toolsModel.OnButtonDown(nMsg == WM_LBUTTONDBLCLK, pt.x, pt.y, TRUE);
toolsModel.OnButtonDown(bLeftButton, pt.x, pt.y, TRUE);
toolsModel.resetTool();
Invalidate(FALSE);
return 0;
}
LRESULT CCanvasWindow::OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDblClk(TRUE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonDblClk(FALSE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (m_nMouseDownMsg == WM_MBUTTONDOWN)
{
INT x = GetScrollPos(SB_HORZ) - (pt.x - m_ptOrig.x);
INT y = GetScrollPos(SB_VERT) - (pt.y - m_ptOrig.y);
SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, x), 0);
SendMessage(WM_VSCROLL, MAKEWPARAM(SB_THUMBPOSITION, y), 0);
m_ptOrig = pt;
return 0;
}
CanvasToImage(pt);
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
Invalidate();
if (m_hitSelection != HIT_NONE)
{
SelectionDragging(pt);
@@ -439,6 +375,14 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (!m_drawing || toolsModel.GetActiveTool() <= TOOL_AIRBRUSH)
{
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
{
Invalidate(FALSE);
UpdateWindow();
CanvasToImage(pt);
drawZoomFrame(pt.x, pt.y);
}
TRACKMOUSEEVENT tme = { sizeof(tme) };
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = m_hWnd;
@@ -447,19 +391,86 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (!m_drawing)
{
RECT rcImage;
GetImageRect(rcImage);
CStringW strCoord;
if (::PtInRect(&rcImage, pt))
strCoord.Format(L"%ld, %ld", pt.x, pt.y);
::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord);
CString strCoord;
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
}
}
if (m_drawing)
{
toolsModel.DrawWithMouseTool(pt, wParam);
// values displayed in statusbar
LONG xRel = pt.x - g_ptStart.x;
LONG yRel = pt.y - g_ptStart.y;
switch (toolsModel.GetActiveTool())
{
// freesel, rectsel and text tools always show numbers limited to fit into image area
case TOOL_FREESEL:
case TOOL_RECTSEL:
case TOOL_TEXT:
if (xRel < 0)
xRel = (pt.x < 0) ? -g_ptStart.x : xRel;
else if (pt.x > imageModel.GetWidth())
xRel = imageModel.GetWidth() - g_ptStart.x;
if (yRel < 0)
yRel = (pt.y < 0) ? -g_ptStart.y : yRel;
else if (pt.y > imageModel.GetHeight())
yRel = imageModel.GetHeight() - g_ptStart.y;
break;
// while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14
case TOOL_RUBBER:
case TOOL_PEN:
case TOOL_BRUSH:
case TOOL_AIRBRUSH:
case TOOL_SHAPE:
{
CString strCoord;
strCoord.Format(_T("%ld, %ld"), pt.x, pt.y);
::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord);
break;
}
default:
break;
}
// rectsel and shape tools always show non-negative numbers when drawing
if (toolsModel.GetActiveTool() == TOOL_RECTSEL || toolsModel.GetActiveTool() == TOOL_SHAPE)
{
if (xRel < 0)
xRel = -xRel;
if (yRel < 0)
yRel = -yRel;
}
if (wParam & MK_LBUTTON)
{
toolsModel.OnMouseMove(TRUE, pt.x, pt.y);
Invalidate(FALSE);
if ((toolsModel.GetActiveTool() >= TOOL_TEXT) || toolsModel.IsSelection())
{
CString strSize;
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
yRel = xRel;
strSize.Format(_T("%ld x %ld"), xRel, yRel);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
}
}
if (wParam & MK_RBUTTON)
{
toolsModel.OnMouseMove(FALSE, pt.x, pt.y);
Invalidate(FALSE);
if (toolsModel.GetActiveTool() >= TOOL_TEXT)
{
CString strSize;
if ((toolsModel.GetActiveTool() >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
yRel = xRel;
strSize.Format(_T("%ld x %ld"), xRel, yRel);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
}
}
return 0;
}
@@ -511,9 +522,9 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
cyImage = min(MAXWORD, cyImage);
// Display new size
CStringW strSize;
strSize.Format(L"%d x %d", cxImage, cyImage);
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize);
CString strSize;
strSize.Format(_T("%d x %d"), cxImage, cyImage);
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
// Dragging now... Fix the position...
CRect rcResizing = { 0, 0, cxImage, cyImage };
@@ -544,22 +555,19 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
return 0;
}
LRESULT CCanvasWindow::OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
CanvasToImage(pt);
::ReleaseCapture();
BOOL bLeftButton = (m_nMouseDownMsg == WM_LBUTTONDOWN);
m_nMouseDownMsg = 0;
if (m_drawing)
{
m_drawing = FALSE;
toolsModel.OnButtonUp(bLeftButton, pt.x, pt.y);
Invalidate(FALSE);
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L"");
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
return 0;
}
else if (m_hitSelection != HIT_NONE && bLeftButton)
@@ -610,11 +618,21 @@ LRESULT CCanvasWindow::OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
m_hitCanvasSizeBox = HIT_NONE;
toolsModel.resetTool(); // resets the point-buffer of the polygon and bezier functions
updateScrollRange();
Update(NULL);
Invalidate(TRUE);
return 0;
}
LRESULT CCanvasWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonUp(TRUE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return OnLRButtonUp(FALSE, nMsg, wParam, lParam, bHandled);
}
LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (CWaitCursor::IsWaiting())
@@ -623,12 +641,6 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
return 0;
}
if (m_nMouseDownMsg == WM_MBUTTONDOWN)
{
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG)));
return 0;
}
POINT pt;
::GetCursorPos(&pt);
ScreenToClient(&pt);
@@ -646,7 +658,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (hitSelection != HIT_NONE)
{
if (!setCursorOnSizeBox(hitSelection))
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL));
::SetCursor(::LoadCursor(NULL, IDC_SIZEALL));
return 0;
}
@@ -659,22 +671,22 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
switch (toolsModel.GetActiveTool())
{
case TOOL_FILL:
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_FILL)));
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_FILL)));
break;
case TOOL_COLOR:
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_COLOR)));
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_COLOR)));
break;
case TOOL_ZOOM:
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_ZOOM)));
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_ZOOM)));
break;
case TOOL_PEN:
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_PEN)));
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_PEN)));
break;
case TOOL_AIRBRUSH:
::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_AIRBRUSH)));
::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_AIRBRUSH)));
break;
default:
::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_CROSS));
::SetCursor(::LoadCursor(NULL, IDC_CROSS));
}
return 0;
}
@@ -691,7 +703,6 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
{
// Cancel dragging
::ReleaseCapture();
m_nMouseDownMsg = 0;
m_hitCanvasSizeBox = HIT_NONE;
::SetRectEmpty(&m_rcResizing);
Invalidate(TRUE);
@@ -711,12 +722,12 @@ LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
LRESULT CCanvasWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return ::SendMessageW(GetParent(), nMsg, wParam, lParam);
return ::SendMessage(GetParent(), nMsg, wParam, lParam);
}
LRESULT CCanvasWindow::OnCaptureChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L"");
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
return 0;
}
@@ -739,17 +750,17 @@ LRESULT CCanvasWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
VOID CCanvasWindow::cancelDrawing()
{
selectionModel.ClearColorImage();
selectionModel.ClearMaskImage();
selectionModel.ClearColor();
selectionModel.ClearMask();
m_hitSelection = HIT_NONE;
m_drawing = FALSE;
toolsModel.OnEndDraw(TRUE);
toolsModel.OnCancelDraw();
Invalidate(FALSE);
}
VOID CCanvasWindow::finishDrawing()
{
toolsModel.OnEndDraw(FALSE);
toolsModel.OnFinishDraw();
m_drawing = FALSE;
Invalidate(FALSE);
}
@@ -779,12 +790,6 @@ VOID CCanvasWindow::StartSelectionDrag(HITTEST hit, POINT ptImage)
VOID CCanvasWindow::SelectionDragging(POINT ptImage)
{
if (selectionModel.m_nSelectionBrush)
{
imageModel.SelectionClone(selectionModel.m_nSelectionBrush == 1);
selectionModel.m_nSelectionBrush = 2; // Selection Brush is ON and drawn
}
selectionModel.Dragging(m_hitSelection, ptImage);
Invalidate(FALSE);
}

View File

@@ -10,7 +10,7 @@
class CCanvasWindow : public CWindowImpl<CCanvasWindow>
{
public:
DECLARE_WND_CLASS_EX(L"ReactOSPaintCanvas", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
DECLARE_WND_CLASS_EX(_T("ReactOSPaintCanvas"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
COLOR_APPWORKSPACE)
BEGIN_MSG_MAP(CCanvasWindow)
@@ -20,15 +20,13 @@ public:
MESSAGE_HANDLER(WM_HSCROLL, OnHScroll)
MESSAGE_HANDLER(WM_VSCROLL, OnVScroll)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnButtonDown)
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnButtonDown)
MESSAGE_HANDLER(WM_MBUTTONDOWN, OnButtonDown)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnButtonDblClk)
MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnButtonDblClk)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnRButtonDblClk)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
MESSAGE_HANDLER(WM_LBUTTONUP, OnButtonUp)
MESSAGE_HANDLER(WM_RBUTTONUP, OnButtonUp)
MESSAGE_HANDLER(WM_MBUTTONUP, OnButtonUp)
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel)
MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode)
@@ -44,8 +42,7 @@ public:
VOID cancelDrawing();
VOID finishDrawing();
VOID updateScrollRange();
VOID updateScrollPos(INT x = 0, INT y = 0);
VOID Update(HWND hwndFrom);
VOID ImageToCanvas(POINT& pt);
VOID ImageToCanvas(RECT& rc);
@@ -53,8 +50,6 @@ public:
VOID CanvasToImage(RECT& rc, BOOL bZoomed = FALSE);
VOID GetImageRect(RECT& rc);
VOID MoveSelection(INT xDelta, INT yDelta);
VOID getNewZoomRect(CRect& rcView, INT newZoom, CPoint ptTarget);
VOID zoomTo(INT newZoom, LONG left = 0, LONG top = 0);
protected:
HITTEST m_hitSelection;
@@ -67,6 +62,7 @@ protected:
RECT GetBaseRect();
VOID DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint);
VOID OnHVScroll(WPARAM wParam, INT fnBar);
VOID drawZoomFrame(INT mouseX, INT mouseY);
HITTEST SelectionHitTest(POINT ptImage);
VOID StartSelectionDrag(HITTEST hit, POINT ptImage);
@@ -78,8 +74,14 @@ protected:
LRESULT OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnEraseBkgnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
@@ -87,8 +89,7 @@ protected:
LRESULT OnCtlColorEdit(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPaletteModelColorChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
UINT m_nMouseDownMsg = 0;
LRESULT OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLRButtonDblClk(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};

View File

@@ -43,17 +43,8 @@ enum HITTEST // hit
/* FUNCTIONS ********************************************************/
void ShowOutOfMemory(void);
BOOL zoomTo(int newZoom, int mouseX, int mouseY);
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1);
void updateStartAndLast(LONG x, LONG y);
void updateLast(LONG x, LONG y);
BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
#define DEG2RAD(degree) (((degree) * M_PI) / 180)
#define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI))
template <typename T>
inline void Swap(T& a, T& b)
{
T tmp = a;
a = b;
b = tmp;
}

View File

@@ -113,21 +113,22 @@ LRESULT CAttributesDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam,
if (g_isAFile)
{
WCHAR date[100], temp[100];
GetDateFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date));
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp));
StringCchCatW(date, _countof(date), L" ");
StringCchCatW(date, _countof(date), temp);
CStringW strSize;
TCHAR date[100];
TCHAR temp[100];
GetDateFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date));
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp));
_tcscat(date, _T(" "));
_tcscat(date, temp);
CString strSize;
strSize.Format(IDS_FILESIZE, g_fileSize);
SetDlgItemText(IDD_ATTRIBUTESTEXT6, date);
SetDlgItemText(IDD_ATTRIBUTESTEXT7, strSize);
}
CStringW strUnit;
CString strUnit;
GetDlgItemText(IDD_ATTRIBUTESTEXT8, strUnit);
CStringW strRes;
CString strRes;
if (strUnit == L"dpi")
strRes.Format(IDS_PRINTRES, ROUND(g_xDpi), ROUND(g_yDpi));
else
@@ -172,10 +173,10 @@ LRESULT CAttributesDialog::OnRadioButton1(WORD wNotifyCode, WORD wID, HWND hWndC
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1) != BST_CHECKED)
return 0;
CStringW strNum;
strNum.Format(L"%.3lf", newWidth / g_xDpi);
CString strNum;
strNum.Format(_T("%.3lf"), newWidth / g_xDpi);
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
strNum.Format(L"%.3lf", newHeight / g_yDpi);
strNum.Format(_T("%.3lf"), newHeight / g_yDpi);
SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum);
return 0;
}
@@ -185,10 +186,10 @@ LRESULT CAttributesDialog::OnRadioButton2(WORD wNotifyCode, WORD wID, HWND hWndC
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2) != BST_CHECKED)
return 0;
CStringW strNum;
strNum.Format(L"%.3lf", newWidth / PpcmFromDpi(g_xDpi));
CString strNum;
strNum.Format(_T("%.3lf"), newWidth / PpcmFromDpi(g_xDpi));
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
strNum.Format(L"%.3lf", newHeight / PpcmFromDpi(g_yDpi));
strNum.Format(_T("%.3lf"), newHeight / PpcmFromDpi(g_yDpi));
SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum);
return 0;
}
@@ -207,21 +208,21 @@ LRESULT CAttributesDialog::OnEdit1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
{
if (Edit_GetModify(hWndCtl))
{
WCHAR tempS[100];
TCHAR tempS[100];
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
newWidth = max(1, (int)(wcstod(tempS, NULL) * g_xDpi));
newWidth = max(1, (int) (_tcstod(tempS, NULL) * g_xDpi));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
newWidth = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_xDpi)));
newWidth = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_xDpi)));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS));
newWidth = max(1, _wtoi(tempS));
newWidth = max(1, _tstoi(tempS));
}
Edit_SetModify(hWndCtl, FALSE);
}
@@ -232,21 +233,21 @@ LRESULT CAttributesDialog::OnEdit2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
{
if (Edit_GetModify(hWndCtl))
{
WCHAR tempS[100];
TCHAR tempS[100];
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
newHeight = max(1, (int)(wcstod(tempS, NULL) * g_yDpi));
newHeight = max(1, (int) (_tcstod(tempS, NULL) * g_yDpi));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
newHeight = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_yDpi)));
newHeight = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_yDpi)));
}
else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3))
{
GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS));
newHeight = max(1, _wtoi(tempS));
newHeight = max(1, _tstoi(tempS));
}
Edit_SetModify(hWndCtl, FALSE);
}
@@ -272,7 +273,9 @@ LRESULT CStretchSkewDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
LRESULT CStretchSkewDialog::OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
CStringW strrcIntNumbers, strrcPercentage, strrcAngle;
CString strrcIntNumbers;
CString strrcPercentage;
CString strrcAngle;
BOOL tr1, tr2, tr3, tr4;
strrcIntNumbers.LoadString(g_hinstExe, IDS_INTNUMBERS);
@@ -302,11 +305,11 @@ LRESULT CStretchSkewDialog::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, B
}
static INT CALLBACK
EnumFontFamProc(ENUMLOGFONTW *lpelf, NEWTEXTMETRICW *lpntm, INT FontType, LPARAM lParam)
EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, INT FontType, LPARAM lParam)
{
CSimpleArray<CStringW>& arrFontNames = *reinterpret_cast<CSimpleArray<CStringW>*>(lParam);
LPWSTR name = lpelf->elfLogFont.lfFaceName;
if (name[0] == L'@') // Vertical fonts
CSimpleArray<CString>& arrFontNames = *reinterpret_cast<CSimpleArray<CString>*>(lParam);
LPTSTR name = lpelf->elfLogFont.lfFaceName;
if (name[0] == TEXT('@')) // Vertical fonts
return TRUE;
for (INT i = 0; i < arrFontNames.GetSize(); ++i)
@@ -328,24 +331,24 @@ CFontsDialog::CFontsDialog()
void CFontsDialog::InitFontNames()
{
// List the fonts
CSimpleArray<CStringW> arrFontNames;
CSimpleArray<CString> arrFontNames;
HDC hDC = CreateCompatibleDC(NULL);
if (hDC)
{
EnumFontFamiliesW(hDC, NULL, (FONTENUMPROCW)EnumFontFamProc,
reinterpret_cast<LPARAM>(&arrFontNames));
::DeleteDC(hDC);
EnumFontFamilies(hDC, NULL, (FONTENUMPROC)EnumFontFamProc,
reinterpret_cast<LPARAM>(&arrFontNames));
DeleteDC(hDC);
}
// Actually add them to the combobox
HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
::SendMessageW(hwndNames, CB_RESETCONTENT, 0, 0);
SendMessage(hwndNames, CB_RESETCONTENT, 0, 0);
for (INT i = 0; i < arrFontNames.GetSize(); ++i)
{
ComboBox_AddString(hwndNames, arrFontNames[i]);
}
::SetWindowTextW(hwndNames, registrySettings.strFontName);
::SetWindowText(hwndNames, registrySettings.strFontName);
}
void CFontsDialog::InitFontSizes()
@@ -358,10 +361,10 @@ void CFontsDialog::InitFontSizes()
HWND hwndSizes = GetDlgItem(IDD_FONTSSIZES);
ComboBox_ResetContent(hwndSizes);
WCHAR szText[16];
TCHAR szText[16];
for (UINT i = 0; i < _countof(s_sizes); ++i)
{
StringCchPrintfW(szText, _countof(szText), L"%d", s_sizes[i]);
wsprintf(szText, TEXT("%d"), s_sizes[i]);
INT iItem = ComboBox_AddString(hwndSizes, szText);
if (s_sizes[i] == (INT)registrySettings.PointSize)
ComboBox_SetCurSel(hwndSizes, iItem);
@@ -369,27 +372,27 @@ void CFontsDialog::InitFontSizes()
if (ComboBox_GetCurSel(hwndSizes) == CB_ERR)
{
StringCchPrintfW(szText, _countof(szText), L"%d", (INT)registrySettings.PointSize);
::SetWindowTextW(hwndSizes, szText);
wsprintf(szText, TEXT("%d"), (INT)registrySettings.PointSize);
::SetWindowText(hwndSizes, szText);
}
}
void CFontsDialog::InitToolbar()
{
HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
::SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
::SendMessageW(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
::SendMessageW(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
SendMessage(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
SendMessage(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
TBADDBITMAP AddBitmap;
AddBitmap.hInst = g_hinstExe;
AddBitmap.nID = IDB_FONTSTOOLBAR;
::SendMessageW(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
SendMessage(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCEW(IDB_FONTSTOOLBAR),
HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCE(IDB_FONTSTOOLBAR),
16, 8, RGB(255, 0, 255), IMAGE_BITMAP,
LR_CREATEDIBSECTION);
::SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
TBBUTTON buttons[] =
{
@@ -398,11 +401,11 @@ void CFontsDialog::InitToolbar()
{ 2, IDM_UNDERLINE, TBSTATE_ENABLED, TBSTYLE_CHECK },
{ 3, IDM_VERTICAL, 0, TBSTYLE_CHECK }, // TODO:
};
::SendMessageW(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons);
SendMessage(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons);
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold);
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic);
::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline);
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold);
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic);
SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline);
}
LRESULT CFontsDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -438,7 +441,7 @@ void CFontsDialog::OnFontName(UINT codeNotify)
HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
INT iItem = CB_ERR;
UINT cch;
WCHAR szText[LF_FACESIZE];
TCHAR szText[LF_FACESIZE];
switch (codeNotify)
{
@@ -446,7 +449,9 @@ void CFontsDialog::OnFontName(UINT codeNotify)
iItem = ComboBox_GetCurSel(hwndNames);
cch = ComboBox_GetLBTextLen(hwndNames, iItem);
if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
{
ComboBox_GetLBText(hwndNames, iItem, szText);
}
break;
case CBN_EDITCHANGE:
@@ -477,13 +482,13 @@ void CFontsDialog::OnFontSize(UINT codeNotify)
if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
{
ComboBox_GetLBText(hwndSizes, iItem, szText);
PointSize = _wtoi(szText);
PointSize = _ttoi(szText);
}
break;
case CBN_EDITCHANGE:
::GetWindowTextW(hwndSizes, szText, _countof(szText));
PointSize = _wtoi(szText);
::GetWindowText(hwndSizes, szText, _countof(szText));
PointSize = _ttoi(szText);
break;
}
@@ -499,7 +504,7 @@ LRESULT CFontsDialog::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
UINT id = LOWORD(wParam);
UINT codeNotify = HIWORD(wParam);
HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
BOOL bChecked = (BOOL)::SendMessageW(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
BOOL bChecked = ::SendMessage(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
switch (id)
{
@@ -543,14 +548,14 @@ LRESULT CFontsDialog::OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
NMHDR *pnmhdr = reinterpret_cast<NMHDR *>(lParam);
if (pnmhdr->code == TTN_NEEDTEXT)
{
LPTOOLTIPTEXTW pToolTip = reinterpret_cast<LPTOOLTIPTEXTW>(lParam);
LPTOOLTIPTEXT pToolTip = reinterpret_cast<LPTOOLTIPTEXT>(lParam);
pToolTip->hinst = g_hinstExe;
switch (pnmhdr->idFrom)
{
case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_BOLD); break;
case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_ITALIC); break;
case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_UNDERLINE); break;
case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_VERTICAL); break;
case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCE(IDS_BOLD); break;
case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCE(IDS_ITALIC); break;
case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCE(IDS_UNDERLINE); break;
case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCE(IDS_VERTICAL); break;
default:
break;
@@ -599,29 +604,29 @@ LRESULT CFontsDialog::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
if (pDrawItem->itemID == (UINT)-1)
return TRUE;
::SetBkMode(pDrawItem->hDC, TRANSPARENT);
SetBkMode(pDrawItem->hDC, TRANSPARENT);
HWND hwndItem = pDrawItem->hwndItem;
RECT rcItem = pDrawItem->rcItem;
if (pDrawItem->itemState & ODS_SELECTED)
{
::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
else
{
::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT));
FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT));
}
WCHAR szText[LF_FACESIZE];
TCHAR szText[LF_FACESIZE];
if ((UINT)ComboBox_GetLBTextLen(hwndItem, pDrawItem->itemID) < _countof(szText))
{
szText[0] = 0;
ComboBox_GetLBText(hwndItem, pDrawItem->itemID, szText);
rcItem.left += 24;
::DrawTextW(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
DrawText(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
}
if (pDrawItem->itemState & ODS_FOCUS)

View File

@@ -6,6 +6,7 @@
*/
#include "precomp.h"
#include <math.h>
INT g_fileSize = 0;
float g_xDpi = 96;
@@ -87,7 +88,7 @@ CreateColorDIB(int width, int height, COLORREF rgb)
HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy)
{
BITMAP bm;
if (!::GetObjectW(hbm, sizeof(bm), &bm))
if (!GetObject(hbm, sizeof(bm), &bm))
return NULL;
if (cx == 0 || cy == 0)
@@ -96,19 +97,19 @@ HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy)
cy = bm.bmHeight;
}
HBITMAP hbmNew = ::CreateBitmap(cx, cy, 1, 1, NULL);
HBITMAP hbmNew = CreateBitmap(cx, cy, 1, 1, NULL);
if (!hbmNew)
return NULL;
HDC hdc1 = ::CreateCompatibleDC(NULL);
HDC hdc2 = ::CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = ::SelectObject(hdc1, hbm);
HGDIOBJ hbm2Old = ::SelectObject(hdc2, hbmNew);
::StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
::SelectObject(hdc1, hbm1Old);
::SelectObject(hdc2, hbm2Old);
::DeleteDC(hdc1);
::DeleteDC(hdc2);
HDC hdc1 = CreateCompatibleDC(NULL);
HDC hdc2 = CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = SelectObject(hdc1, hbm);
HGDIOBJ hbm2Old = SelectObject(hdc2, hbmNew);
StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
SelectObject(hdc1, hbm1Old);
SelectObject(hdc2, hbm2Old);
DeleteDC(hdc1);
DeleteDC(hdc2);
return hbmNew;
}
@@ -120,7 +121,7 @@ HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight)
minimalHeight = 1;
BITMAP bm;
if (!GetObjectW(hbm, sizeof(bm), &bm))
if (!GetObject(hbm, sizeof(bm), &bm))
hbm = NULL;
if (hbm && minimalWidth <= bm.bmWidth && minimalHeight <= bm.bmHeight)
@@ -136,7 +137,7 @@ int
GetDIBWidth(HBITMAP hBitmap)
{
BITMAP bm;
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
GetObject(hBitmap, sizeof(BITMAP), &bm);
return bm.bmWidth;
}
@@ -144,7 +145,7 @@ int
GetDIBHeight(HBITMAP hBitmap)
{
BITMAP bm;
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
GetObject(hBitmap, sizeof(BITMAP), &bm);
return bm.bmHeight;
}
@@ -211,8 +212,8 @@ void SetFileInfo(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isAFile)
}
// set title
CStringW strTitle;
strTitle.Format(IDS_WINDOWTITLE, PathFindFileNameW(g_szFileName));
CString strTitle;
strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName));
mainWindow.SetWindowText(strTitle);
// update file info and recent
@@ -228,14 +229,11 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
COLORREF white = RGB(255, 255, 255);
HBITMAP hBitmap = CreateColorDIB(registrySettings.BMPWidth, registrySettings.BMPHeight, white);
if (hBitmap == NULL)
{
ShowOutOfMemory();
return NULL;
}
HDC hScreenDC = ::GetDC(NULL);
g_xDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSX);
g_yDpi = (float)::GetDeviceCaps(hScreenDC, LOGPIXELSY);
g_xDpi = ::GetDeviceCaps(hScreenDC, LOGPIXELSX);
g_yDpi = ::GetDeviceCaps(hScreenDC, LOGPIXELSY);
::ReleaseDC(NULL, hScreenDC);
return SetBitmapAndInfo(hBitmap, name, pFound, isFile);
@@ -244,7 +242,6 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
{
// update image
canvasWindow.updateScrollPos();
imageModel.PushImageForUndo(hBitmap);
imageModel.ClearHistory();
@@ -258,7 +255,7 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
CWaitCursor waitCursor;
// find the file
WIN32_FIND_DATAW find;
WIN32_FIND_DATA find;
HANDLE hFind = ::FindFirstFileW(name, &find);
if (hFind == INVALID_HANDLE_VALUE) // does not exist
{
@@ -278,14 +275,8 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
CImageDx img;
float xDpi = 0, yDpi = 0;
HRESULT hr = img.LoadDx(name, &xDpi, &yDpi);
if (FAILED(hr) && fIsMainFile)
{
imageModel.ClearHistory();
hr = img.LoadDx(name, &xDpi, &yDpi);
}
if (FAILED(hr))
{
ATLTRACE("hr: 0x%08lX\n", hr);
ShowError(IDS_LOADERRORTEXT, name);
return NULL;
}
@@ -297,8 +288,8 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile)
if (xDpi <= 0 || yDpi <= 0)
{
HDC hDC = ::GetDC(NULL);
xDpi = (float)::GetDeviceCaps(hDC, LOGPIXELSX);
yDpi = (float)::GetDeviceCaps(hDC, LOGPIXELSY);
xDpi = ::GetDeviceCaps(hDC, LOGPIXELSX);
yDpi = ::GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(NULL, hDC);
}
@@ -348,6 +339,10 @@ HBITMAP Rotate90DegreeBlt(HDC hDC1, INT cx, INT cy, BOOL bRight, BOOL bMono)
return hbm2;
}
#ifndef M_PI
#define M_PI 3.14159265
#endif
HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
{
CWaitCursor waitCursor;
@@ -358,7 +353,7 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
const double eTan = tan(abs(nDegree) * M_PI / 180);
BITMAP bm;
::GetObjectW(hbm, sizeof(bm), &bm);
GetObjectW(hbm, sizeof(bm), &bm);
INT cx = bm.bmWidth, cy = bm.bmHeight, dx = 0, dy = 0;
if (bVertical)
dy = INT(cx * eTan);
@@ -384,9 +379,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
{
INT delta = INT(x * eTan);
if (nDegree > 0)
::BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY);
else
::BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY);
}
}
else
@@ -395,9 +390,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
{
INT delta = INT(y * eTan);
if (nDegree > 0)
::BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY);
else
::BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY);
}
}
@@ -406,39 +401,6 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono)
return hbmNew;
}
HBITMAP getSubImage(HBITMAP hbmWhole, const RECT& rcPartial)
{
CRect rc = rcPartial;
HBITMAP hbmPart = CreateDIBWithProperties(rc.Width(), rc.Height());
if (!hbmPart)
return NULL;
HDC hDC1 = ::CreateCompatibleDC(NULL);
HDC hDC2 = ::CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = ::SelectObject(hDC1, hbmWhole);
HGDIOBJ hbm2Old = ::SelectObject(hDC2, hbmPart);
::BitBlt(hDC2, 0, 0, rc.Width(), rc.Height(), hDC1, rc.left, rc.top, SRCCOPY);
::SelectObject(hDC1, hbm1Old);
::SelectObject(hDC2, hbm2Old);
::DeleteDC(hDC1);
::DeleteDC(hDC2);
return hbmPart;
}
void putSubImage(HBITMAP hbmWhole, const RECT& rcPartial, HBITMAP hbmPart)
{
CRect rc = rcPartial;
HDC hDC1 = ::CreateCompatibleDC(NULL);
HDC hDC2 = ::CreateCompatibleDC(NULL);
HGDIOBJ hbm1Old = ::SelectObject(hDC1, hbmWhole);
HGDIOBJ hbm2Old = ::SelectObject(hDC2, hbmPart);
::BitBlt(hDC1, rc.left, rc.top, rc.Width(), rc.Height(), hDC2, 0, 0, SRCCOPY);
::SelectObject(hDC1, hbm1Old);
::SelectObject(hDC2, hbm2Old);
::DeleteDC(hDC1);
::DeleteDC(hDC2);
}
struct BITMAPINFODX : BITMAPINFO
{
RGBQUAD bmiColorsAdditional[256 - 1];
@@ -449,7 +411,7 @@ HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap)
CWaitCursor waitCursor;
BITMAP bm;
if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm))
if (!GetObject(hBitmap, sizeof(BITMAP), &bm))
return NULL;
BITMAPINFODX bmi;
@@ -633,7 +595,7 @@ HBITMAP ConvertToBlackAndWhite(HBITMAP hbm)
CWaitCursor waitCursor;
BITMAP bm;
if (!::GetObjectW(hbm, sizeof(bm), &bm))
if (!::GetObject(hbm, sizeof(bm), &bm))
return NULL;
BITMAPINFOEX bmi;

View File

@@ -44,5 +44,3 @@ float PpcmFromDpi(float dpi);
HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap);
HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal);
HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF);
HBITMAP getSubImage(HBITMAP hbmWhole, const RECT& rcPartial);
void putSubImage(HBITMAP hbmWhole, const RECT& rcPartial, HBITMAP hbmPart);

View File

@@ -17,7 +17,6 @@ Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness)
HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
SetPixelV(hdc, x2, y2, color);
DeleteObject(SelectObject(hdc, oldPen));
}
@@ -116,7 +115,7 @@ Fill(HDC hdc, LONG x, LONG y, COLORREF color)
void
Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
{
LONG b = max(1, max(labs(x2 - x1), labs(y2 - y1)));
LONG b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
HBRUSH hbr = ::CreateSolidBrush(color);
for (LONG a = 0; a <= b; a++)
@@ -133,7 +132,7 @@ Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
void
Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
{
LONG b = max(1, max(labs(x2 - x1), labs(y2 - y1)));
LONG b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
for (LONG a = 0; a <= b; a++)
{
@@ -165,66 +164,73 @@ Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
}
void
Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style, INT thickness)
Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
{
HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
HBRUSH oldBrush = (HBRUSH) SelectObject(hdc, CreateSolidBrush(color));
if (thickness <= 1)
LONG a, b;
b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
switch (style)
{
Line(hdc, x1, y1, x2, y2, color, thickness);
}
else
{
LONG a, b = max(1, max(labs(x2 - x1), labs(y2 - y1)));
switch ((BrushStyle)style)
case 0:
for(a = 0; a <= b; a++)
Ellipse(hdc, (x1 * (b - a) + x2 * a) / b - 3, (y1 * (b - a) + y2 * a) / b - 3,
(x1 * (b - a) + x2 * a) / b + 4, (y1 * (b - a) + y2 * a) / b + 4);
break;
case 1:
for(a = 0; a <= b; a++)
Ellipse(hdc,
(x1 * (b - a) + x2 * a) / b - 2,
(y1 * (b - a) + y2 * a) / b - 2,
(x1 * (b - a) + x2 * a) / b + 2,
(y1 * (b - a) + y2 * a) / b + 2);
break;
case 2:
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
::SetPixelV(hdc, x2, y2, color);
break;
case 3:
for(a = 0; a <= b; a++)
Rectangle(hdc,
(x1 * (b - a) + x2 * a) / b - 4,
(y1 * (b - a) + y2 * a) / b - 4,
(x1 * (b - a) + x2 * a) / b + 4,
(y1 * (b - a) + y2 * a) / b + 4);
break;
case 4:
for(a = 0; a <= b; a++)
Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 2, (y1 * (b - a) + y2 * a) / b - 2,
(x1 * (b - a) + x2 * a) / b + 3, (y1 * (b - a) + y2 * a) / b + 3);
break;
case 5:
for(a = 0; a <= b; a++)
Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 1, (y1 * (b - a) + y2 * a) / b - 1,
(x1 * (b - a) + x2 * a) / b + 1, (y1 * (b - a) + y2 * a) / b + 1);
break;
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
{
case BrushStyleRound:
for (a = 0; a <= b; a++)
{
Ellipse(hdc,
(x1 * (b - a) + x2 * a) / b - (thickness / 2),
(y1 * (b - a) + y2 * a) / b - (thickness / 2),
(x1 * (b - a) + x2 * a) / b + (thickness / 2),
(y1 * (b - a) + y2 * a) / b + (thickness / 2));
}
break;
case BrushStyleSquare:
for (a = 0; a <= b; a++)
{
Rectangle(hdc,
(x1 * (b - a) + x2 * a) / b - (thickness / 2),
(y1 * (b - a) + y2 * a) / b - (thickness / 2),
(x1 * (b - a) + x2 * a) / b + (thickness / 2),
(y1 * (b - a) + y2 * a) / b + (thickness / 2));
}
break;
case BrushStyleForeSlash:
case BrushStyleBackSlash:
{
POINT offsetTop, offsetBottom;
if ((BrushStyle)style == BrushStyleForeSlash)
{
offsetTop = { (thickness - 1) / 2, -(thickness - 1) / 2 };
offsetBottom = { -thickness / 2, thickness / 2 };
}
else
{
offsetTop = { -thickness / 2, -thickness / 2 };
offsetBottom = { (thickness - 1) / 2, (thickness - 1) / 2 };
}
POINT points[4] =
{
{ x1 + offsetTop.x, y1 + offsetTop.y },
{ x1 + offsetBottom.x, y1 + offsetBottom.y },
{ x2 + offsetBottom.x, y2 + offsetBottom.y },
{ x2 + offsetTop.x, y2 + offsetTop.y },
};
Polygon(hdc, points, _countof(points));
break;
}
POINT offsTop[] = {{3, -3}, {2, -2}, {0, 0},
{-4, -4}, {-2, -2}, {-1, 0}};
POINT offsBtm[] = {{-3, 3}, {-2, 2}, {-1, 1},
{3, 3}, {2, 2}, {0, 1}};
LONG idx = style - 6;
POINT pts[4];
pts[0].x = x1 + offsTop[idx].x;
pts[0].y = y1 + offsTop[idx].y;
pts[1].x = x1 + offsBtm[idx].x;
pts[1].y = y1 + offsBtm[idx].y;
pts[2].x = x2 + offsBtm[idx].x;
pts[2].y = y2 + offsBtm[idx].y;
pts[3].x = x2 + offsTop[idx].x;
pts[3].y = y2 + offsTop[idx].y;
Polygon(hdc, pts, 4);
break;
}
}
DeleteObject(SelectObject(hdc, oldBrush));
@@ -253,37 +259,38 @@ RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
}
void
Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style)
Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style)
{
INT iSaveDC = ::SaveDC(hdc); // We will modify the clipping region. Save now.
INT iSaveDC = SaveDC(hdc); // We will modify the clipping region. Save now.
RECT rc;
::SetRect(&rc, x1, y1, x2, y2);
SetRect(&rc, x1, y1, x2, y2);
if (style == 0) // Transparent
{
::SetBkMode(hdc, TRANSPARENT);
SetBkMode(hdc, TRANSPARENT);
GetBkColor(hdc);
}
else // Opaque
{
::SetBkMode(hdc, OPAQUE);
::SetBkColor(hdc, bg);
SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, bg);
HBRUSH hbr = ::CreateSolidBrush(bg);
::FillRect(hdc, &rc, hbr); // Fill the background
::DeleteObject(hbr);
HBRUSH hbr = CreateSolidBrush(bg);
FillRect(hdc, &rc, hbr); // Fill the background
DeleteObject(hbr);
}
IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
HGDIOBJ hFontOld = ::SelectObject(hdc, font);
::SetTextColor(hdc, fg);
HGDIOBJ hFontOld = SelectObject(hdc, font);
SetTextColor(hdc, fg);
const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP |
DT_EXPANDTABS | DT_WORDBREAK;
::DrawTextW(hdc, lpchText, -1, &rc, uFormat);
::SelectObject(hdc, hFontOld);
DrawText(hdc, lpchText, -1, &rc, uFormat);
SelectObject(hdc, hFontOld);
::RestoreDC(hdc, iSaveDC); // Restore
RestoreDC(hdc, iSaveDC); // Restore
}
BOOL

View File

@@ -27,11 +27,11 @@ void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r);
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style, INT thickness);
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style);
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style);
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style);
BOOL
ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,

View File

@@ -22,8 +22,8 @@ HWND CFullscreenWindow::DoCreate()
LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON)));
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
return 0;
}
@@ -44,7 +44,7 @@ LRESULT CFullscreenWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
INT cyDest = imageModel.GetHeight();
INT xDest = (rcWnd.right - rcWnd.left - cxDest) / 2;
INT yDest = (rcWnd.bottom - rcWnd.top - cyDest) / 2;
::BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
BitBlt(hDC, xDest, yDest, cxDest, cyDest, imageModel.GetDC(), 0, 0, SRCCOPY);
EndPaint(&ps);
return 0;
}

View File

@@ -10,7 +10,7 @@
class CFullscreenWindow : public CWindowImpl<CFullscreenWindow>
{
public:
DECLARE_WND_CLASS_EX(L"FullscreenWindow", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
COLOR_BACKGROUND)
BEGIN_MSG_MAP(CFullscreenWindow)

View File

@@ -11,9 +11,11 @@
extern BOOL g_askBeforeEnlarging;
extern POINT g_ptStart, g_ptEnd;
extern HINSTANCE g_hinstExe;
extern WCHAR g_szFileName[MAX_LONG_PATH];
extern TCHAR g_szFileName[MAX_LONG_PATH];
extern BOOL g_isAFile;
extern BOOL g_imageSaved;
extern BOOL g_showGrid;

View File

@@ -12,24 +12,12 @@ ImageModel imageModel;
/* FUNCTIONS ********************************************************/
void IMAGE_PART::clear()
{
::DeleteObject(m_hbmImage);
m_hbmImage = NULL;
m_rcPart.SetRectEmpty();
m_bPartial = FALSE;
}
void ImageModel::NotifyImageChanged()
{
if (canvasWindow.IsWindow())
{
canvasWindow.updateScrollRange();
canvasWindow.Invalidate();
}
canvasWindow.Invalidate(FALSE);
if (miniature.IsWindow())
miniature.Invalidate();
miniature.Invalidate(FALSE);
}
ImageModel::ImageModel()
@@ -38,37 +26,23 @@ ImageModel::ImageModel()
, m_undoSteps(0)
, m_redoSteps(0)
{
ZeroMemory(m_historyItems, sizeof(m_historyItems));
ZeroMemory(m_hBms, sizeof(m_hBms));
m_hbmMaster = CreateColorDIB(1, 1, RGB(255, 255, 255));
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hbmMaster);
m_hBms[0] = CreateColorDIB(1, 1, RGB(255, 255, 255));
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[0]);
g_imageSaved = TRUE;
}
ImageModel::~ImageModel()
{
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
::DeleteDC(m_hDrawingDC);
::DeleteObject(m_hbmMaster);
ClearHistory();
}
void ImageModel::SwapPart()
{
IMAGE_PART& part = m_historyItems[m_currInd];
if (!part.m_bPartial)
for (size_t i = 0; i < HISTORYSIZE; ++i)
{
Swap(m_hbmMaster, part.m_hbmImage);
return;
if (m_hBms[i])
::DeleteObject(m_hBms[i]);
}
HBITMAP hbmMaster = LockBitmap();
HBITMAP hbmPart = getSubImage(hbmMaster, part.m_rcPart);
putSubImage(hbmMaster, part.m_rcPart, part.m_hbmImage);
::DeleteObject(part.m_hbmImage);
part.m_hbmImage = hbmPart;
UnlockBitmap(hbmMaster);
}
void ImageModel::Undo(BOOL bClearRedo)
@@ -79,10 +53,9 @@ void ImageModel::Undo(BOOL bClearRedo)
selectionModel.HideSelection();
m_currInd = (m_currInd + HISTORYSIZE - 1) % HISTORYSIZE; // Go previous
ATLASSERT(m_hbmMaster != NULL);
SwapPart();
::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
// Select previous item
m_currInd = (m_currInd + HISTORYSIZE - 1) % HISTORYSIZE;
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
m_undoSteps--;
if (bClearRedo)
@@ -101,10 +74,9 @@ void ImageModel::Redo()
selectionModel.HideSelection();
ATLASSERT(m_hbmMaster != NULL);
SwapPart();
m_currInd = (m_currInd + 1) % HISTORYSIZE; // Go next
::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
// Select next item
m_currInd = (m_currInd + 1) % HISTORYSIZE;
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
m_redoSteps--;
if (m_undoSteps < HISTORYSIZE - 1)
@@ -113,67 +85,33 @@ void ImageModel::Redo()
NotifyImageChanged();
}
void ImageModel::ClearHistory()
void ImageModel::ResetToPrevious()
{
for (int i = 0; i < HISTORYSIZE; ++i)
{
m_historyItems[i].clear();
}
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
m_undoSteps = 0;
m_redoSteps = 0;
// Revert current item with previous item
::DeleteObject(m_hBms[m_currInd]);
m_hBms[m_currInd] = CopyDIBImage(m_hBms[(m_currInd + HISTORYSIZE - 1) % HISTORYSIZE]);
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
NotifyImageChanged();
}
void ImageModel::PushImageForUndo()
void ImageModel::ClearHistory()
{
HBITMAP hbm = CopyBitmap();
if (hbm == NULL)
{
ShowOutOfMemory();
return;
}
PushImageForUndo(hbm);
m_undoSteps = 0;
m_redoSteps = 0;
}
void ImageModel::PushImageForUndo(HBITMAP hbm)
{
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
if (hbm == NULL)
{
ShowOutOfMemory();
return;
}
IMAGE_PART& part = m_historyItems[m_currInd];
part.clear();
part.m_hbmImage = m_hbmMaster;
m_hbmMaster = hbm;
::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
PushDone();
}
void ImageModel::PushImageForUndo(const RECT& rcPartial)
{
ATLTRACE("%s: %d\n", __FUNCTION__, m_currInd);
IMAGE_PART& part = m_historyItems[m_currInd];
part.clear();
part.m_bPartial = TRUE;
part.m_rcPart = rcPartial;
HBITMAP hbmMaster = LockBitmap();
part.m_hbmImage = getSubImage(hbmMaster, rcPartial);
UnlockBitmap(hbmMaster);
PushDone();
}
void ImageModel::PushDone()
{
m_currInd = (m_currInd + 1) % HISTORYSIZE; // Go next
// Go to the next item with an HBITMAP or current item
::DeleteObject(m_hBms[(m_currInd + 1) % HISTORYSIZE]);
m_hBms[(m_currInd + 1) % HISTORYSIZE] = (hbm ? hbm : CopyDIBImage(m_hBms[m_currInd]));
m_currInd = (m_currInd + 1) % HISTORYSIZE;
::SelectObject(m_hDrawingDC, m_hBms[m_currInd]);
if (m_undoSteps < HISTORYSIZE - 1)
m_undoSteps++;
@@ -191,29 +129,37 @@ void ImageModel::Crop(int nWidth, int nHeight, int nOffsetX, int nOffsetY)
if (nHeight <= 0)
nHeight = 1;
// Create a white HBITMAP
HBITMAP hbmNew = CreateColorDIB(nWidth, nHeight, RGB(255, 255, 255));
if (!hbmNew)
{
ShowOutOfMemory();
// Create an HBITMAP
HBITMAP hbmCropped = CreateDIBWithProperties(nWidth, nHeight);
if (!hbmCropped)
return;
}
// Put the master image as a sub-image
RECT rcPart = { -nOffsetX, -nOffsetY, GetWidth() - nOffsetX, GetHeight() - nOffsetY };
HBITMAP hbmOld = imageModel.LockBitmap();
putSubImage(hbmNew, rcPart, hbmOld);
imageModel.UnlockBitmap(hbmOld);
// Select the HBITMAP by memory DC
HDC hdcMem = ::CreateCompatibleDC(m_hDrawingDC);
HGDIOBJ hbmOld = ::SelectObject(hdcMem, hbmCropped);
// Fill background of the HBITMAP
RECT rcBack = { 0, 0, nWidth, nHeight };
HBRUSH hbrBack = ::CreateSolidBrush(paletteModel.GetBgColor());
::FillRect(hdcMem, &rcBack, hbrBack);
::DeleteObject(hbrBack);
// Copy the old content
::BitBlt(hdcMem, -nOffsetX, -nOffsetY, GetWidth(), GetHeight(), m_hDrawingDC, 0, 0, SRCCOPY);
// Clean up
::SelectObject(hdcMem, hbmOld);
::DeleteDC(hdcMem);
// Push it
PushImageForUndo(hbmNew);
PushImageForUndo(hbmCropped);
NotifyImageChanged();
}
void ImageModel::SaveImage(LPCWSTR lpFileName)
void ImageModel::SaveImage(LPCTSTR lpFileName)
{
SaveDIBToFile(m_hbmMaster, lpFileName, TRUE);
SaveDIBToFile(m_hBms[m_currInd], lpFileName, TRUE);
}
BOOL ImageModel::IsImageSaved() const
@@ -229,17 +175,17 @@ void ImageModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSk
INT newHeight = oldHeight * nStretchPercentY / 100;
if (oldWidth != newWidth || oldHeight != newHeight)
{
HBITMAP hbm0 = CopyDIBImage(m_hbmMaster, newWidth, newHeight);
HBITMAP hbm0 = CopyDIBImage(m_hBms[m_currInd], newWidth, newHeight);
PushImageForUndo(hbm0);
}
if (nSkewDegX)
{
HBITMAP hbm1 = SkewDIB(m_hDrawingDC, m_hbmMaster, nSkewDegX, FALSE);
HBITMAP hbm1 = SkewDIB(m_hDrawingDC, m_hBms[m_currInd], nSkewDegX, FALSE);
PushImageForUndo(hbm1);
}
if (nSkewDegY)
{
HBITMAP hbm2 = SkewDIB(m_hDrawingDC, m_hbmMaster, nSkewDegY, TRUE);
HBITMAP hbm2 = SkewDIB(m_hDrawingDC, m_hBms[m_currInd], nSkewDegY, TRUE);
PushImageForUndo(hbm2);
}
NotifyImageChanged();
@@ -247,12 +193,12 @@ void ImageModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSk
int ImageModel::GetWidth() const
{
return GetDIBWidth(m_hbmMaster);
return GetDIBWidth(m_hBms[m_currInd]);
}
int ImageModel::GetHeight() const
{
return GetDIBHeight(m_hbmMaster);
return GetDIBHeight(m_hBms[m_currInd]);
}
void ImageModel::InvertColors()
@@ -292,14 +238,15 @@ void ImageModel::RotateNTimes90Degrees(int iN)
case 3:
{
HBITMAP hbm = Rotate90DegreeBlt(m_hDrawingDC, GetWidth(), GetHeight(), iN == 1, FALSE);
PushImageForUndo(hbm);
if (hbm)
PushImageForUndo(hbm);
break;
}
case 2:
{
PushImageForUndo();
::StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(),
m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY);
StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(),
m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY);
break;
}
}
@@ -314,53 +261,27 @@ void ImageModel::Clamp(POINT& pt) const
HBITMAP ImageModel::CopyBitmap()
{
HBITMAP hBitmap = LockBitmap();
HBITMAP ret = CopyDIBImage(hBitmap);
UnlockBitmap(hBitmap);
// NOTE: An app cannot select a bitmap into more than one device context at a time.
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
HBITMAP ret = CopyDIBImage(m_hBms[m_currInd]);
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); // Re-select
return ret;
}
BOOL ImageModel::IsBlackAndWhite()
{
HBITMAP hBitmap = LockBitmap();
BOOL bBlackAndWhite = IsBitmapBlackAndWhite(hBitmap);
UnlockBitmap(hBitmap);
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
BOOL bBlackAndWhite = IsBitmapBlackAndWhite(m_hBms[m_currInd]);
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); // Re-select
return bBlackAndWhite;
}
void ImageModel::PushBlackAndWhite()
{
HBITMAP hBitmap = LockBitmap();
HBITMAP hNewBitmap = ConvertToBlackAndWhite(hBitmap);
UnlockBitmap(hBitmap);
PushImageForUndo(hNewBitmap);
}
HBITMAP ImageModel::LockBitmap()
{
// NOTE: An app cannot select a bitmap into more than one device context at a time.
::SelectObject(m_hDrawingDC, m_hbmOld); // De-select
HBITMAP hbmLocked = m_hbmMaster;
m_hbmMaster = NULL;
return hbmLocked;
}
void ImageModel::UnlockBitmap(HBITMAP hbmLocked)
{
m_hbmMaster = hbmLocked;
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
}
void ImageModel::SelectionClone(BOOL bUndoable)
{
if (!selectionModel.m_bShow || ::IsRectEmpty(&selectionModel.m_rc))
return;
if (bUndoable)
PushImageForUndo();
selectionModel.DrawSelection(m_hDrawingDC, paletteModel.GetBgColor(),
toolsModel.IsBackgroundTransparent());
NotifyImageChanged();
HBITMAP hNewBitmap = ConvertToBlackAndWhite(m_hBms[m_currInd]);
m_hbmOld = ::SelectObject(m_hDrawingDC, m_hBms[m_currInd]); // Re-select
if (hNewBitmap)
PushImageForUndo(hNewBitmap);
}

View File

@@ -10,15 +10,6 @@
/* HISTORYSIZE = number of possible undo-steps + 1 */
#define HISTORYSIZE 11
struct IMAGE_PART
{
CRect m_rcPart;
HBITMAP m_hbmImage;
BOOL m_bPartial;
void clear();
};
class ImageModel
{
public:
@@ -28,21 +19,18 @@ public:
HDC GetDC();
BOOL CanUndo() const { return m_undoSteps > 0; }
BOOL CanRedo() const { return m_redoSteps > 0; }
void PushImageForUndo();
void PushImageForUndo(HBITMAP hbm);
void PushImageForUndo(const RECT& rcPartial);
void PushImageForUndo(HBITMAP hbm = NULL);
void ResetToPrevious(void);
void Undo(BOOL bClearRedo = FALSE);
void Redo(void);
void ClearHistory(void);
void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0);
void SaveImage(LPCWSTR lpFileName);
void SaveImage(LPCTSTR lpFileName);
BOOL IsImageSaved() const;
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0);
int GetWidth() const;
int GetHeight() const;
HBITMAP CopyBitmap();
HBITMAP LockBitmap();
void UnlockBitmap(HBITMAP hbmLocked);
void InvertColors();
void FlipHorizontally();
void FlipVertically();
@@ -51,17 +39,12 @@ public:
void NotifyImageChanged();
BOOL IsBlackAndWhite();
void PushBlackAndWhite();
void SelectionClone(BOOL bUndoable = TRUE);
protected:
HDC m_hDrawingDC; // The device context for this class
HBITMAP m_hbmMaster; // The master bitmap
int m_currInd; // The current index in m_hBms
int m_undoSteps; // The undo-able count
int m_redoSteps; // The redo-able count
IMAGE_PART m_historyItems[HISTORYSIZE]; // A ring buffer of IMAGE_PARTs
HBITMAP m_hBms[HISTORYSIZE]; // A rotation buffer of HBITMAPs
HGDIOBJ m_hbmOld;
void SwapPart();
void PushDone();
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-bg-BG.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-bg-BG.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-cs-CZ.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-cs-CZ.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-de-DE.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-de-DE.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^U", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-en-GB.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-en-GB.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar.bmp"
IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -10,7 +10,7 @@
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-es-ES.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-es-ES.bmp"
ID_MENU MENU
BEGIN
@@ -142,10 +142,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_ESTONIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-et-EE.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-et-EE.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_BASQUE, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-eu-ES.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-eu-ES.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-fr-FR.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-fr-FR.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-he-IL.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-he-IL.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-hu-HU.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-hu-HU.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-id-ID.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-id-ID.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-it-IT.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-it-IT.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -9,7 +9,7 @@
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ja-JP.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ja-JP.bmp"
ID_MENU MENU
BEGIN
@@ -141,10 +141,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-nl-NL.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-nl-NL.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-no-NO.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-no-NO.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -10,7 +10,7 @@
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pl-PL.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pl-PL.bmp"
ID_MENU MENU
BEGIN
@@ -142,10 +142,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-BR.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-BR.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-PT.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-PT.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -9,7 +9,7 @@
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ro-RO.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ro-RO.bmp"
ID_MENU MENU
BEGIN
@@ -17,8 +17,8 @@ BEGIN
BEGIN
MENUITEM "&Nou\tCtrl+N", IDM_FILENEW
MENUITEM "&Deschidere...\tCtrl+O", IDM_FILEOPEN
MENUITEM "&Salvează\tCtrl+S", IDM_FILESAVE
MENUITEM "Salvea&ză ca...", IDM_FILESAVEAS
MENUITEM "&Păstrează\tCtrl+S", IDM_FILESAVE
MENUITEM "Păst&rare în...", IDM_FILESAVEAS
MENUITEM SEPARATOR
MENUITEM "Din aparat media...", IDM_FILEFROMSCANNERORCAMERA
MENUITEM SEPARATOR
@@ -141,10 +141,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100
@@ -234,7 +230,7 @@ BEGIN
IDS_WINDOWTITLE "%s - Pictare"
IDS_INFOTITLE "Pictare pentru ReactOS"
IDS_INFOTEXT "Disponibilă sub licența GNU Lesser General Public (vedeți www.gnu.org)"
IDS_SAVEPROMPTTEXT "Doriți salvarea modificărilor din %s?"
IDS_SAVEPROMPTTEXT "Doriți păstrarea modificărilor din %s?"
IDS_DEFAULTFILENAME "Fără nume"
IDS_MINIATURETITLE "Miniatură"
IDS_TOOLTIP1 "Golire selecție"
@@ -267,7 +263,7 @@ BEGIN
IDS_VERTICAL "Vertical"
IDS_PRINTRES "%d x %d pixeli/cm"
IDS_CANTPASTE "Nu a putut fi lipit din clipboard. Formatul de date este fie incorect, fie nesuportat."
IDS_SAVEERROR "Eșec în salvarea imaginii bitmap („hartă de biți”) în fișierul:\n\n%s"
IDS_SAVEERROR "Eșec în păstrarea imaginii bitmap („hartă de biți”) în fișierul:\n\n%s"
IDS_CANTSENDMAIL "Eșec în trimiterea unei scrisori."
IDS_LOSECOLOR "În această operațiune informațiile legate de culoare vor fi pierdute. Sigur veți continua?"
END

View File

@@ -11,7 +11,7 @@
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ru-RU.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ru-RU.bmp"
ID_MENU MENU
BEGIN
@@ -143,10 +143,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sk-SK.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sk-SK.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sq-AL.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sq-AL.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sv-SE.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sv-SE.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-tr-TR.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-tr-TR.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -9,7 +9,7 @@
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-uk-UA.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-uk-UA.bmp"
ID_MENU MENU
BEGIN
@@ -141,10 +141,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,7 +7,7 @@
LANGUAGE LANG_VIETNAMESE, SUBLANG_VIETNAMESE_VIETNAM
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-vi-VN.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-vi-VN.bmp"
ID_MENU MENU
BEGIN
@@ -139,10 +139,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -10,7 +10,7 @@
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-CN.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-CN.bmp"
ID_MENU MENU
BEGIN
@@ -142,10 +142,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_HONGKONG
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-HK.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-HK.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -8,7 +8,7 @@
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-TW.bmp"
//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-TW.bmp"
ID_MENU MENU
BEGIN
@@ -140,10 +140,6 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View File

@@ -7,12 +7,13 @@
#include "precomp.h"
#include <dlgs.h>
#include <mapi.h>
#include <mapicode.h>
POINT g_ptStart, g_ptEnd;
BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry
HINSTANCE g_hinstExe = NULL;
WCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
TCHAR g_szFileName[MAX_LONG_PATH] = { 0 };
WCHAR g_szMailTempFile[MAX_LONG_PATH] = { 0 };
BOOL g_isAFile = FALSE;
BOOL g_imageSaved = FALSE;
@@ -22,32 +23,20 @@ CMainWindow mainWindow;
/* FUNCTIONS ********************************************************/
void ShowOutOfMemory(void)
{
WCHAR szText[256];
::FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
ERROR_OUTOFMEMORY,
0,
szText, _countof(szText),
NULL);
mainWindow.MessageBox(szText, NULL, MB_ICONERROR);
}
// get file name extension from filter string
static BOOL
FileExtFromFilter(LPWSTR pExt, OPENFILENAME *pOFN)
FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN)
{
LPWSTR pchExt = pExt;
LPTSTR pchExt = pExt;
*pchExt = 0;
DWORD nIndex = 1;
for (LPCWSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
for (LPCTSTR pch = pOFN->lpstrFilter; *pch; ++nIndex)
{
pch += lstrlen(pch) + 1;
if (pOFN->nFilterIndex == nIndex)
{
for (++pch; *pch && *pch != L';'; ++pch)
for (++pch; *pch && *pch != _T(';'); ++pch)
{
*pchExt++ = *pch;
}
@@ -55,7 +44,7 @@ FileExtFromFilter(LPWSTR pExt, OPENFILENAME *pOFN)
CharLower(pExt);
return TRUE;
}
pch += wcslen(pch) + 1;
pch += lstrlen(pch) + 1;
}
return FALSE;
}
@@ -65,19 +54,19 @@ static UINT_PTR APIENTRY
OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hParent;
OFNOTIFYW *pon;
WCHAR Path[MAX_PATH];
OFNOTIFY *pon;
switch (uMsg)
{
case WM_NOTIFY:
pon = (OFNOTIFYW *)lParam;
pon = (OFNOTIFY *)lParam;
if (pon->hdr.code == CDN_TYPECHANGE)
{
hParent = GetParent(hwnd);
SendMessageW(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path);
FileExtFromFilter(PathFindExtensionW(Path), pon->lpOFN);
SendMessageW(hParent, CDM_SETCONTROLTEXT, cmb13, (LPARAM)PathFindFileNameW(Path));
StringCchCopyW(pon->lpOFN->lpstrFile, pon->lpOFN->nMaxFile, Path);
TCHAR Path[MAX_PATH];
SendMessage(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path);
FileExtFromFilter(PathFindExtension(Path), pon->lpOFN);
SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)PathFindFileName(Path));
lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile);
}
break;
}
@@ -128,9 +117,9 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
strFileTitle += L".png";
// Save it to the temporary file
HBITMAP hbmLocked = imageModel.LockBitmap();
BOOL ret = SaveDIBToFile(hbmLocked, g_szMailTempFile, FALSE, Gdiplus::ImageFormatPNG);
imageModel.UnlockBitmap(hbmLocked);
HBITMAP hbm = imageModel.CopyBitmap();
BOOL ret = SaveDIBToFile(hbm, g_szMailTempFile, FALSE, Gdiplus::ImageFormatPNG);
::DeleteObject(hbm);
if (!ret)
{
g_szMailTempFile[0] = UNICODE_NULL;
@@ -194,22 +183,21 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName)
return FALSE; // Failure
}
BOOL CMainWindow::GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
{
static OPENFILENAMEW ofn = { 0 };
static CStringW strFilter;
static OPENFILENAME ofn = { 0 };
static CString strFilter;
if (ofn.lStructSize == 0)
{
// The "All Files" item text
CStringW strAllPictureFiles;
CString strAllPictureFiles;
strAllPictureFiles.LoadString(g_hinstExe, IDS_ALLPICTUREFILES);
// Get the import filter
CSimpleArray<GUID> aguidFileTypesI;
CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles,
CImage::excludeDefaultLoad, L'|');
strFilter.Replace(L'|', UNICODE_NULL);
CImage::excludeDefaultLoad, _T('\0'));
// Initializing the OPENFILENAME structure for GetOpenFileName
ZeroMemory(&ofn, sizeof(ofn));
@@ -223,21 +211,20 @@ BOOL CMainWindow::GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
ofn.lpstrFile = pszFile;
ofn.nMaxFile = cchMaxFile;
return ::GetOpenFileNameW(&ofn);
return ::GetOpenFileName(&ofn);
}
BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile)
{
static OPENFILENAMEW sfn = { 0 };
static CStringW strFilter;
static OPENFILENAME sfn = { 0 };
static CString strFilter;
if (sfn.lStructSize == 0)
{
// Get the export filter
CSimpleArray<GUID> aguidFileTypesE;
CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL,
CImage::excludeDefaultSave, L'|');
strFilter.Replace(L'|', UNICODE_NULL);
CImage::excludeDefaultSave, _T('\0'));
// Initializing the OPENFILENAME structure for GetSaveFileName
ZeroMemory(&sfn, sizeof(sfn));
@@ -253,7 +240,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
if (*pchDotExt == UNICODE_NULL)
{
// Choose PNG
StringCchCatW(pszFile, cchMaxFile, L".png");
wcscat(pszFile, L".png");
for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
{
if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
@@ -267,7 +254,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile)
sfn.lpstrFile = pszFile;
sfn.nMaxFile = cchMaxFile;
return ::GetSaveFileNameW(&sfn);
return ::GetSaveFileName(&sfn);
}
BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor)
@@ -299,9 +286,9 @@ BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor)
HWND CMainWindow::DoCreate()
{
::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName));
::LoadString(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName));
CStringW strTitle;
CString strTitle;
strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName));
RECT& rc = registrySettings.WindowPlacement.rcNormalPosition;
@@ -310,8 +297,13 @@ HWND CMainWindow::DoCreate()
// entry point
INT WINAPI
wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow)
{
#ifdef _DEBUG
// Report any memory leaks on exit
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
g_hinstExe = hInstance;
// Initialize common controls library
@@ -326,7 +318,7 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCm
// Create the main window
if (!mainWindow.DoCreate())
{
MessageBox(NULL, L"Failed to create main window.", NULL, MB_ICONERROR);
MessageBox(NULL, TEXT("Failed to create main window."), NULL, MB_ICONERROR);
return 1;
}
@@ -338,7 +330,7 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCm
mainWindow.ShowWindow(registrySettings.WindowPlacement.showCmd);
// Load the access keys
HACCEL hAccel = ::LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(800));
HACCEL hAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(800));
// The message loop
MSG msg;
@@ -347,7 +339,7 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCm
if (fontsDialog.IsWindow() && fontsDialog.IsDialogMessage(&msg))
continue;
if (::TranslateAcceleratorW(mainWindow, hAccel, &msg))
if (::TranslateAccelerator(mainWindow, hAccel, &msg))
continue;
::TranslateMessage(&msg);

View File

@@ -36,8 +36,8 @@ HWND CMiniatureWindow::DoCreate(HWND hwndParent)
(LONG)(registrySettings.ThumbYPos + registrySettings.ThumbHeight)
};
WCHAR strTitle[100];
::LoadStringW(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
TCHAR strTitle[100];
::LoadString(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle));
DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME;
return Create(hwndParent, rc, strTitle, style, WS_EX_PALETTEWINDOW);

Some files were not shown because too many files have changed in this diff Show More