Commit 597257dd833c9cfb98411dee943679e5a2a6302d
1 parent
03564892
Exists in
master
and in
3 other branches
Adjustments in selection data.
Showing
2 changed files
with
25 additions
and
15 deletions
Show diff stats
src/include/lib3270/selection.h
| ... | ... | @@ -42,31 +42,40 @@ |
| 42 | 42 | * @brief Selection element |
| 43 | 43 | * |
| 44 | 44 | */ |
| 45 | - typedef struct _lib3270_selection_element { | |
| 46 | - unsigned char chr; ///< @brief Element character. | |
| 47 | - unsigned short flags; ///< @brief Element colors & visual state. @see LIB3270_ATTR | |
| 48 | - unsigned char field_attributes; ///< @brief Field attribute. @see LIB3270_FIELD_ATTRIBUTE | |
| 45 | + typedef struct _lib3270_selection_element | |
| 46 | + { | |
| 47 | + unsigned char chr; ///< @brief Element character. | |
| 48 | + | |
| 49 | + struct | |
| 50 | + { | |
| 51 | + unsigned short visual; ///< @brief Element colors & visual state. @see LIB3270_ATTR | |
| 52 | + unsigned char field; ///< @brief Field attribute. @see LIB3270_FIELD_ATTRIBUTE | |
| 53 | + } attribute; | |
| 54 | + | |
| 49 | 55 | } lib3270_selection_element; |
| 50 | 56 | |
| 51 | 57 | /** |
| 52 | - * @brief A rectangle containing the selected area. | |
| 58 | + * @brief A rectangle with informations about the selected area. | |
| 53 | 59 | * |
| 54 | 60 | */ |
| 55 | 61 | typedef struct _lib3270_selection |
| 56 | 62 | { |
| 63 | + /// @brief Cursor address. | |
| 64 | + unsigned int cursor_address; | |
| 65 | + | |
| 66 | + /// @brief Clipboard rectangle. | |
| 57 | 67 | struct { |
| 58 | 68 | unsigned int row; |
| 59 | 69 | unsigned int col; |
| 60 | 70 | unsigned int width; |
| 61 | 71 | unsigned int height; |
| 72 | + } bounds; | |
| 62 | 73 | |
| 63 | - } bounds; ///< @brief Clipboard rectangle. | |
| 64 | - | |
| 74 | + /// @brief Selection contents. | |
| 65 | 75 | lib3270_selection_element contents[1]; |
| 66 | 76 | |
| 67 | 77 | } lib3270_selection; |
| 68 | 78 | |
| 69 | - | |
| 70 | 79 | LIB3270_EXPORT int lib3270_unselect(H3270 *session); |
| 71 | 80 | LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr); |
| 72 | 81 | LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr); |
| ... | ... | @@ -84,7 +93,7 @@ |
| 84 | 93 | |
| 85 | 94 | LIB3270_SELECTION_CUT = 0x0001, ///< @brief Cut selected data (if available). |
| 86 | 95 | LIB3270_SELECTION_ALL = 0x0002, ///< @brief Get all data (the default is get only selected data). |
| 87 | - LIB3270_SELECTION_UNPROTECTED_ONLY = 0x0004, ///< @brief Get only unprotected contents. | |
| 96 | +// LIB3270_SELECTION_UNPROTECTED_ONLY = 0x0004, ///< @brief Get only unprotected contents. | |
| 88 | 97 | |
| 89 | 98 | } LIB3270_SELECTION_OPTIONS; |
| 90 | 99 | ... | ... |
src/lib3270/selection/get.c
| ... | ... | @@ -156,10 +156,11 @@ LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cu |
| 156 | 156 | // Get output buffer. |
| 157 | 157 | lib3270_selection * selection = lib3270_malloc(sizeof(lib3270_selection) + (sizeof(lib3270_selection_element) * (width*height))); |
| 158 | 158 | |
| 159 | - selection->bounds.col = col; | |
| 160 | - selection->bounds.row = row; | |
| 161 | - selection->bounds.height = height; | |
| 162 | - selection->bounds.width = width; | |
| 159 | + selection->bounds.col = col; | |
| 160 | + selection->bounds.row = row; | |
| 161 | + selection->bounds.height = height; | |
| 162 | + selection->bounds.width = width; | |
| 163 | + selection->cursor_address = lib3270_get_cursor_address(hSession); | |
| 163 | 164 | |
| 164 | 165 | unsigned int dstaddr = 0; |
| 165 | 166 | |
| ... | ... | @@ -183,8 +184,8 @@ LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cu |
| 183 | 184 | } |
| 184 | 185 | |
| 185 | 186 | selection->contents[dstaddr].chr = (hSession->text[baddr].chr ? hSession->text[baddr].chr : ' '); |
| 186 | - selection->contents[dstaddr].flags = hSession->text[baddr].attr; | |
| 187 | - selection->contents[dstaddr].field_attributes = fa; | |
| 187 | + selection->contents[dstaddr].attribute.visual = hSession->text[baddr].attr; | |
| 188 | + selection->contents[dstaddr].attribute.field = fa; | |
| 188 | 189 | |
| 189 | 190 | if(cut && !FA_IS_PROTECTED(fa)) { |
| 190 | 191 | clear_chr(hSession,baddr); | ... | ... |