#ifndef lint
static char sccsid[] = "@(#)fv.file.c 1.1 92/07/30 Copyr 1988 Sun Micro";
#endif
/* Copyright (c) 1987, 1988, Sun Microsystems, Inc. All Rights Reserved.
Sun considers its source code as an unpublished, proprietary
trade secret, and it is available only under strict license
provisions. This copyright notice is placed here only to protect
Sun in the event the source is deemed a published work. Dissassembly,
decompilation, or other means of reducing the object code to human
readable form is prohibited by the license agreement under which
this code is provided to the user or company in possession of this
copy.
RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the
Government is subject to restrictions as set forth in subparagraph
(c)(1)(ii) of the Rights in Technical Data and Computer Software
clause at DFARS 52.227-7013 and in similar clauses in the FAR and
NASA FAR Supplement. */
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/wait.h>
#include <string.h>
#ifdef OS3
# include <sys/dir.h>
#else
# include <dirent.h>
#endif
#ifdef SV1
#include <suntool/sunview.h>
#include <suntool/panel.h>
#include <suntool/tty.h>
#include <suntool/textsw.h>
#include <suntool/canvas.h>
#include <suntool/scrollbar.h>
#include <suntool/alert.h>
#include <suntool/fullscreen.h>
#else
#include <view2/view2.h>
#include <view2/panel.h>
#include <view2/tty.h>
#include <view2/textsw.h>
#include <view2/canvas.h>
#include <view2/scrollbar.h>
#include <view2/alert.h>
#include <view2/fullscreen.h>
#include <view2/seln.h>
#endif
#include "fv.port.h"
#include "fv.h"
#include "fv.extern.h"
/* The following three arrays contain the 8 or so RGB values for colors */
#include "fv.colormap.h"
u_char Fv_red[CMS_FVCOLORMAPSIZE];
u_char Fv_blue[CMS_FVCOLORMAPSIZE];
u_char Fv_green[CMS_FVCOLORMAPSIZE];
#define COLOR_FILE "..color" /* Contains sorted pairs of color/name*/
static short Ncolors; /* # color entries in COLOR_FILE*/
static char *Color_fname[MAXFILES]; /* Name... */
static SBYTE Color_code[MAXFILES]; /* ...and color pairs */
static int Maxfilesperline; /* Maximum files per line */
static int Incx; /* Columnar Increment */
static int Startx; /* Starting location */
static short Widest_name; /* Widest file name */
/* Variable and fixed widths for List Options */
static short Permission_width[2] = {8, 11};
static short Link_width[2] = {3, 5};
static short Owner_width[2] = {5, 9};
static short Group_width[2] = {5, 9};
static short Size_width[2] = {5, 9};
static short Date_width[2] = {9, 14};
static char Last_edited[MAXPATH]; /* Last edited filename */
#define ERASE 0177 /* Delete key on Sun-3 keyboards */
#define MAXRENAMELEN 80 /* Max length of rename string */
#define THRESHOLD 4 /* Move/copy mode (in pixels) */
#define LIST_HEIGHT 20 /* Height of lines in List mode */
static int compare_name(), compare_time(), compare_size(), compare_type(),
compare_color();
static ROUTINE Compare_fn[FV_SORTCOLOR+1] = {
compare_name, compare_time, compare_size, compare_type, compare_color,
};
extern time_t time();
static short If_image[] = {
#include "folderwin.icon"
};
mpr_static_static(f_icon_pr, 64, 48, 1, If_image);
static short Id_image[] = {
#include "docwin.icon"
};
mpr_static_static(d_icon_pr, 64, 64, 1, Id_image);
#ifdef SV1
static struct icon F_icon;
static struct icon D_icon;
#endif
#define MAX_TEXTSW 32
#ifdef SV1
static int Edit_id[MAX_TEXTSW];
static Textsw Edit_sw[MAX_TEXTSW];
#endif
static Frame Edit_fr[MAX_TEXTSW];
static int Edit_no;
#define MAX_FOLDERS 16
static Frame Folder_frame[MAX_FOLDERS]; /* Folder frames */
static int Nfolders;
static int Max_alloc; /* Number of allocated FV_FILE */
#define SIX_MONTHS_IN_SECS 15552000
#define HOUR_IN_SECS 3600
#define ICON_AREA_HEIGHT 66 /* Icon height + text height + gap */
static Panel Text_panel;
static Panel_item Text_item;
static int Scroll_increment;
static int Renamed_file; /* Index in Fv_file */
static void stop_editing();
#ifdef SV1
# define GET_SCROLL_VIEW_START (int)scrollbar_get(Fv_foldr.vsbar, SCROLL_VIEW_START)
#else
# define GET_SCROLL_VIEW_START ((int)scrollbar_get(Fv_foldr.vsbar, SCROLL_VIEW_START) * Scroll_increment)
#endif
void
fv_create_folder() /* Create folder canvas */
{
register int i; /* Index */
Notify_value folder_event();
static int display_folder();
struct singlecolor *color;
Fv_foldr.canvas = window_create(Fv_frame, CANVAS,
CANVAS_FAST_MONO, TRUE,
CANVAS_AUTO_SHRINK, FALSE,
CANVAS_AUTO_CLEAR, FALSE,
CANVAS_RETAINED, FALSE,
CANVAS_REPAINT_PROC, display_folder,
CANVAS_FIXED_IMAGE, FALSE,
WIN_BELOW, Fv_tree.canvas,
WIN_X, 0,
WIN_Y, 0,
WIN_ROWS, 10,
WIN_VERTICAL_SCROLLBAR,
Fv_foldr.vsbar = scrollbar_create(
#ifdef SV1
SCROLL_PLACEMENT, SCROLL_EAST, 0
#endif
),
0);
#ifdef SV1
Fv_foldr.pw = (PAINTWIN)canvas_pixwin(Fv_foldr.canvas);
Fv_color = Fv_foldr.pw->pw_pixrect->pr_depth > 1;
#else
Fv_foldr.pw = (PAINTWIN)vu_get(Fv_foldr.canvas, CANVAS_NTH_PAINT_WINDOW, 0);
Fv_color = (int)vu_get(Fv_frame, WIN_DEPTH) > 1;
#endif
if (Fv_color)
{
/* Apply color first; then decide whether this is a color monitor.
* Otherwise we have problems with single color monitor systems that
* have the monochrome and color framebuffer on the same device.
* Later:
* Shit! We still screwed. If you supply color on a monochrome
* device we try and use it. (It appears black.)
*/
cms_fvcolormapsetup(Fv_red, Fv_green, Fv_blue);
if (window_get(Fv_frame, FRAME_INHERIT_COLORS))
{
/* Grab the current background and foreground color and
* replace our generic colors (white and black).
* Reverse video display and color inheritance cause
* problems.
*/
color = (struct singlecolor *)window_get(Fv_frame,
FRAME_FOREGROUND_COLOR);
Fv_red[CMS_FVCOLORMAPSIZE-1] = Fv_red[1] = color->red;
Fv_green[CMS_FVCOLORMAPSIZE-1] = Fv_green[1] = color->green;
Fv_blue[CMS_FVCOLORMAPSIZE-1] = Fv_blue[1] = color->blue;
color = (struct singlecolor *)window_get(Fv_frame,
FRAME_BACKGROUND_COLOR);
Fv_red[0] = color->red;
Fv_green[0] = color->green;
Fv_blue[0] = color->blue;
}
pw_setcmsname(Fv_foldr.pw, "FVCOLORMAP");
pw_putcolormap(Fv_foldr.pw, 0, CMS_FVCOLORMAPSIZE,
Fv_red, Fv_green, Fv_blue);
}
#ifdef SV1
notify_interpose_event_func(Fv_foldr.canvas, folder_event, NOTIFY_SAFE);
#else
notify_interpose_event_func(Fv_foldr.pw, folder_event, NOTIFY_SAFE);
#endif
/* Look for events */
window_set(
#ifdef SV1
Fv_foldr.canvas,
#else
Fv_foldr.pw,
#endif
WIN_CONSUME_PICK_EVENTS,
LOC_WINENTER, LOC_WINEXIT,
ERASE, SHIFT_CTRL, LOC_DRAG, KEY_LEFT(K_PROPS),
KEY_LEFT(K_UNDO), KEY_LEFT(K_PUT), KEY_LEFT(K_GET),
KEY_LEFT(K_FIND), KEY_LEFT(K_DELETE), 0,
0);
/* Create a text panel for editing on the canvas */
Text_panel = window_create(Fv_frame, PANEL,
WIN_SHOW, FALSE,
WIN_HEIGHT, 20,
0);
Text_item = panel_create_item(Text_panel, PANEL_TEXT,
PANEL_VALUE_STORED_LENGTH, 255,
PANEL_VALUE_X, 0, PANEL_VALUE_Y, 0,
PANEL_NOTIFY_PROC, stop_editing,
0);
/* Allocate enough memory for file structures.
* Allocating memory dynamically instead of statically allows
* us to swap pointers instead of copying structures whilst
* sorting, etc.
*/
Max_alloc = 128;
for (i=0; i<Max_alloc; i++)
{
Fv_file[i] = (FV_FILE *)fv_malloc(sizeof(FV_FILE));
if (Fv_file[i] == NULL)
break;
}
}
fv_file_scroll_height() /* Set scroll increment */
{
Scroll_increment = Fv_style & FV_DICON ? ICON_AREA_HEIGHT : LIST_HEIGHT;
scrollbar_set(Fv_foldr.vsbar, SCROLL_LINE_HEIGHT, Scroll_increment, 0);
}
static Notify_value
folder_event(cnvs, evnt, arg, typ) /* Process canvas events */
Canvas cnvs;
register Event *evnt;
Notify_arg arg;
Notify_event_type typ;
{
static struct timeval last_click; /* Last click time */
struct timeval click; /* Click time
fv.rar_If...
版权申诉
49 浏览量
2022-09-23
17:26:55
上传
评论
收藏 60KB RAR 举报
林当时
- 粉丝: 100
- 资源: 1万+
最新资源
- 微信小程序 - 同乐居商城:购物车合算源码
- 1、根据输入的三条边值判断能组成何种三角形,并设计测试数据进行判定覆盖测试 三条边为变量a、b、c,范围为1≤边值≤10,不在范
- SQL server 练习题目8道(小白教学).zip
- Python 手写实现 iD3 决策树算法-根据信息增益公式.zip
- 411675952289057车联助手-小窗版(三星)3.5.1.apk
- 三种快速排序方法合并在一个文件中以便直接运行的Python代码示例
- 937712277954201实习5.word
- 2程序语言基础知识pdf1_1716337722703.jpeg
- 简单的Python示例,演示了如何使用TCP/IP协议进行基本的客户端和服务器通信
- 考试.sql
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈