Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
8352f8f7
Commit
8352f8f7
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Add block copy... paste support coming soon.
parent
fedd83cf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/uifc/uifc32.c
+101
-5
101 additions, 5 deletions
src/uifc/uifc32.c
with
101 additions
and
5 deletions
src/uifc/uifc32.c
+
101
−
5
View file @
8352f8f7
...
@@ -112,7 +112,12 @@ static void reset_dynamic(void) {
...
@@ -112,7 +112,12 @@ static void reset_dynamic(void) {
void
uifc_mouse_enable
(
void
)
void
uifc_mouse_enable
(
void
)
{
{
ciomouse_setevents
(
1
<<
CIOLIB_BUTTON_1_CLICK
|
1
<<
CIOLIB_BUTTON_3_CLICK
);
ciomouse_setevents
(
0
);
ciomouse_addevent
(
CIOLIB_BUTTON_1_DRAG_START
);
ciomouse_addevent
(
CIOLIB_BUTTON_1_DRAG_MOVE
);
ciomouse_addevent
(
CIOLIB_BUTTON_1_DRAG_END
);
ciomouse_addevent
(
CIOLIB_BUTTON_1_CLICK
);
ciomouse_addevent
(
CIOLIB_BUTTON_3_CLICK
);
showmouse
();
showmouse
();
}
}
...
@@ -283,6 +288,91 @@ int uifcini32(uifcapi_t* uifcapi)
...
@@ -283,6 +288,91 @@ int uifcini32(uifcapi_t* uifcapi)
return
(
0
);
return
(
0
);
}
}
void
docopy
(
void
)
{
int
key
;
struct
mouse_event
mevent
;
unsigned
char
*
screen
;
unsigned
char
*
sbuffer
;
int
sbufsize
=
0
;
int
x
,
y
,
startx
,
starty
,
endx
,
endy
,
lines
;
int
outpos
;
char
*
copybuf
;
sbufsize
=
api
->
scrn_width
*
2
*
(
api
->
scrn_len
+
1
);
screen
=
(
unsigned
char
*
)
malloc
(
sbufsize
);
sbuffer
=
(
unsigned
char
*
)
malloc
(
sbufsize
);
gettext
(
1
,
1
,
api
->
scrn_width
,
api
->
scrn_len
+
1
,
screen
);
while
(
1
)
{
key
=
getch
();
if
(
key
==
0
||
key
==
0xff
)
key
|=
getch
()
<<
8
;
switch
(
key
)
{
case
CIO_KEY_MOUSE
:
getmouse
(
&
mevent
);
if
(
mevent
.
startx
<
mevent
.
endx
)
{
startx
=
mevent
.
startx
;
endx
=
mevent
.
endx
;
}
else
{
startx
=
mevent
.
endx
;
endx
=
mevent
.
startx
;
}
if
(
mevent
.
starty
<
mevent
.
endy
)
{
starty
=
mevent
.
starty
;
endy
=
mevent
.
endy
;
}
else
{
starty
=
mevent
.
endy
;
endy
=
mevent
.
starty
;
}
switch
(
mevent
.
event
)
{
case
CIOLIB_BUTTON_1_DRAG_MOVE
:
memcpy
(
sbuffer
,
screen
,
sbufsize
);
for
(
y
=
starty
-
1
;
y
<
endy
;
y
++
)
{
for
(
x
=
startx
-
1
;
x
<
endx
;
x
++
)
{
int
pos
=
y
*
api
->
scrn_width
+
x
;
if
((
sbuffer
[
pos
*
2
+
1
]
&
0x70
)
!=
0x10
)
sbuffer
[
pos
*
2
+
1
]
=
sbuffer
[
pos
*
2
+
1
]
&
0x8F
|
0x10
;
else
sbuffer
[
pos
*
2
+
1
]
=
sbuffer
[
pos
*
2
+
1
]
&
0x8F
|
0x60
;
if
(((
sbuffer
[
pos
*
2
+
1
]
&
0x70
)
>>
4
)
==
(
sbuffer
[
pos
*
2
+
1
]
&
0x0F
))
{
sbuffer
[
pos
*
2
+
1
]
|=
0x08
;
}
}
}
puttext
(
1
,
1
,
api
->
scrn_width
,
api
->
scrn_len
+
1
,
sbuffer
);
break
;
case
CIOLIB_BUTTON_1_DRAG_END
:
lines
=
abs
(
mevent
.
endy
-
mevent
.
starty
)
+
1
;
copybuf
=
malloc
((
endy
-
starty
+
1
)
*
(
endx
-
startx
+
1
)
+
1
+
lines
*
2
);
outpos
=
0
;
for
(
y
=
starty
-
1
;
y
<
endy
;
y
++
)
{
for
(
x
=
startx
-
1
;
x
<
endx
;
x
++
)
{
copybuf
[
outpos
++
]
=
screen
[(
y
*
api
->
scrn_width
+
x
)
*
2
];
}
copybuf
[
outpos
++
]
=
'\r'
;
copybuf
[
outpos
++
]
=
'\n'
;
}
copybuf
[
outpos
]
=
0
;
copytext
(
copybuf
,
strlen
(
copybuf
));
puttext
(
1
,
1
,
api
->
scrn_width
,
api
->
scrn_len
+
1
,
screen
);
free
(
copybuf
);
free
(
screen
);
free
(
sbuffer
);
return
;
}
break
;
default:
puttext
(
1
,
1
,
api
->
scrn_width
,
api
->
scrn_len
+
1
,
screen
);
ungetch
(
key
);
free
(
screen
);
free
(
sbuffer
);
return
;
}
}
}
static
int
uifc_getmouse
(
struct
mouse_event
*
mevent
)
static
int
uifc_getmouse
(
struct
mouse_event
*
mevent
)
{
{
mevent
->
startx
=
0
;
mevent
->
startx
=
0
;
...
@@ -292,6 +382,10 @@ static int uifc_getmouse(struct mouse_event *mevent)
...
@@ -292,6 +382,10 @@ static int uifc_getmouse(struct mouse_event *mevent)
getmouse
(
mevent
);
getmouse
(
mevent
);
if
(
mevent
->
event
==
CIOLIB_BUTTON_3_CLICK
)
if
(
mevent
->
event
==
CIOLIB_BUTTON_3_CLICK
)
return
(
ESC
);
return
(
ESC
);
if
(
mevent
->
event
==
CIOLIB_BUTTON_1_DRAG_START
)
{
docopy
();
return
(
0
);
}
if
(
mevent
->
starty
==
api
->
buttony
)
{
if
(
mevent
->
starty
==
api
->
buttony
)
{
if
(
mevent
->
startx
>=
api
->
exitstart
if
(
mevent
->
startx
>=
api
->
exitstart
&&
mevent
->
startx
<=
api
->
exitend
&&
mevent
->
startx
<=
api
->
exitend
...
@@ -800,22 +894,24 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
...
@@ -800,22 +894,24 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
return
(
*
cur
);
return
(
*
cur
);
}
}
/* Clicked Scroll Up */
/* Clicked Scroll Up */
if
(
mevnt
.
startx
==
s_left
+
left
+
1
else
if
(
mevnt
.
startx
==
s_left
+
left
+
1
&&
mevnt
.
starty
==
s_top
+
top
+
3
&&
mevnt
.
starty
==
s_top
+
top
+
3
&&
mevnt
.
event
==
CIOLIB_BUTTON_1_CLICK
)
{
&&
mevnt
.
event
==
CIOLIB_BUTTON_1_CLICK
)
{
i
=
CIO_KEY_PPAGE
;
i
=
CIO_KEY_PPAGE
;
}
}
/* Clicked Scroll Down */
/* Clicked Scroll Down */
if
(
mevnt
.
startx
==
s_left
+
left
+
1
else
if
(
mevnt
.
startx
==
s_left
+
left
+
1
&&
mevnt
.
starty
==
(
s_top
+
top
+
height
)
-
2
&&
mevnt
.
starty
==
(
s_top
+
top
+
height
)
-
2
&&
mevnt
.
event
==
CIOLIB_BUTTON_1_CLICK
)
{
&&
mevnt
.
event
==
CIOLIB_BUTTON_1_CLICK
)
{
i
=
CIO_KEY_NPAGE
;
i
=
CIO_KEY_NPAGE
;
}
}
/* Clicked Outside of Window */
/* Clicked Outside of Window */
if
(
mevnt
.
startx
<
s_left
+
left
else
if
(
(
mevnt
.
startx
<
s_left
+
left
||
mevnt
.
startx
>
s_left
+
left
+
width
-
1
||
mevnt
.
startx
>
s_left
+
left
+
width
-
1
||
mevnt
.
starty
<
s_top
+
top
||
mevnt
.
starty
<
s_top
+
top
||
mevnt
.
starty
>
s_top
+
top
+
height
-
1
)
||
mevnt
.
starty
>
s_top
+
top
+
height
-
1
)
&&
(
mevnt
.
event
==
CIOLIB_BUTTON_1_CLICK
||
mevnt
.
event
==
CIOLIB_BUTTON_3_CLICK
))
i
=
ESC
;
i
=
ESC
;
}
}
}
}
...
@@ -2197,7 +2293,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
...
@@ -2197,7 +2293,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
continue
;
continue
;
}
}
/* Clicked Scroll Down */
/* Clicked Scroll Down */
if
(
mevnt
.
startx
>=
left
+
pad
else
if
(
mevnt
.
startx
>=
left
+
pad
&&
mevnt
.
startx
<=
left
+
pad
+
width
&&
mevnt
.
startx
<=
left
+
pad
+
width
&&
mevnt
.
starty
<=
top
+
pad
+
height
-
2
&&
mevnt
.
starty
<=
top
+
pad
+
height
-
2
&&
mevnt
.
starty
>=
top
+
pad
+
height
-
(
height
/
2
+
1
)
-
2
&&
mevnt
.
starty
>=
top
+
pad
+
height
-
(
height
/
2
+
1
)
-
2
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment