Exemple #1
0
		public void DrawItem (int nth, bool is_selected)
		{
			char ch;
			
			if (nth >= listing.Count)
				throw new Exception ("overflow");

			is_selected = HasFocus && is_selected;
				
			Move (y + (nth-top) + 1, x + 1);
			
			Listing.FileNode node = listing [nth];
			int color;

			if (node == null)
				throw new Exception (String.Format ("Problem fetching item {0}", nth));

			if (node.Info.IsDirectory){
				color = is_selected ? ColorFocus : ColorDir;
				ch = '/';
			} else {
				color = is_selected ? ColorFocus : ColorNormal;
				ch = ' ';
			}
			if (node.Marked)
				color = is_selected ? ColorHotFocus : ColorHotNormal;

			Curses.attrset (color);
			for (int i = 0; i < node.Nested; i++)
				Curses.addstr ("  ");
			Curses.addch (ch);
			Curses.addstr (node.Name);
		}
Exemple #2
0
 void DrawStatus()
 {
     Move(y, x);
     Curses.attrset(Container.ContainerColorFocus);
     for (int i = 0; i < w; i++)
     {
         Curses.addch(' ');
     }
     Move(y, x);
     Curses.addstr("File: FOOBAR");
 }
Exemple #3
0
		public override void Redraw ()
		{
			base.Redraw ();
			Curses.attrset (ContainerColorNormal);
			int files = listing.Count;
			
			for (int i = 0; i < Capacity; i++){
				if (i + top >= files)
					break;

				DrawItem (top+i, top+i == selected);
			}
		}
Exemple #4
0
        public override void Redraw()
        {
            int x = 0;
            int y = Application.Lines - 1;

            Move(y, 0);

            for (int i = 0; i < labels.Length; i++)
            {
                Curses.attrset(Application.ColorBasic);
                Curses.addstr(i == 0 ? "1" : String.Format(" {0}", i + 1));
                Curses.attrset(ColorFocus);
                Curses.addstr("{0,-6}", labels [i]);
            }
        }
Exemple #5
0
        public override void Redraw()
        {
            Curses.attrset(ColorNormal);

            int i = 0;
            int l;
            int n = head > tail ? head - tail : (head + messages.Length) - tail;

            for (l = h - 1; l >= 0 && n-- > 0; l--)
            {
                int item = head - 1 - i;
                if (item < 0)
                {
                    item = messages.Length + item;
                }

                Move(y + l, x);

                int sl = messages [item].Length;
                if (sl < w)
                {
                    Curses.addstr(messages [item]);
                    for (int fi = 0; fi < w - sl; fi++)
                    {
                        Curses.addch(' ');
                    }
                }
                else
                {
                    Curses.addstr(messages [item].Substring(0, sl));
                }
                i++;
            }

            for (; l >= 0; l--)
            {
                Move(y + l, x);
                for (i = 0; i < w; i++)
                {
                    Curses.addch(' ');
                }
            }
        }
Exemple #6
0
 public override void SetAttribute(Attribute c) => Curses.attrset(c.value);
Exemple #7
0
 public override void SetAttribute(Attribute c)
 {
     currentAttribute = c.Value;
     Curses.attrset(currentAttribute);
 }
Exemple #8
0
        void DrawView()
        {
            int  col = 0;
            bool skip_until_newline = false;

            Curses.attrset(Container.ContainerColorNormal);
            Move(y + 1, x);
            SetPosition(top_byte);
            for (int row = 0; row < h;)
            {
                int c = GetChar();
                switch (c)
                {
                /* End of file */
                case -1:
                    ClearToEnd(col, row);
                    row = h;
                    continue;

                case 10:
                    ClearToEnd(col);
                    col = 0;
                    row++;
                    skip_until_newline = false;
                    Move(y + row, x + col);
                    continue;

                case 9:
                    for (int nc = (col / 8 + 1) * 8; col < nc; col++)
                    {
                        Curses.addch(' ');
                    }

                    continue;

                case 13:
                    continue;
                }

                // Control chars or unicode > 0xffff
                if (c < 32 || c > 0xffff)
                {
                    c = '.';
                }

                if (skip_until_newline)
                {
                    continue;
                }

                Curses.addch((char)c);
                col++;
                if (col > w)
                {
                    if (Wrap)
                    {
                        col = 0;
                        row++;
                    }
                    else
                    {
                        skip_until_newline = true;
                    }
                }
            }
        }